<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Help: Run PowerShell Command in API in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-run-powershell-command-in-api/m-p/11641645#M28824</link>
    <description>&lt;P&gt;Dears,&lt;/P&gt;&lt;P&gt;I have this PowerShell command. Please help me how to input to VS.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(Get-Content "D:\Settings.ini") | ForEach-Object { $_ -replace 'OPENAFTEREXPORT=false','OPENAFTEREXPORT=true' } | Set-Content "C:\Settings.ini"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I'm trying with this way:&lt;/P&gt;&lt;P&gt;Put above command line to .ps1 file then open it with these code:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Script = "R:\Testing.ps1"
Shell("PowerShell.exe " &amp;amp; """" &amp;amp; Script &amp;amp; """", vbNormalFocus)&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;Script = "R:\Testing.ps1"
Process.Start("PowerShell.exe", Script)&lt;/LI-CODE&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
    <pubDate>Mon, 26 Dec 2022 06:36:22 GMT</pubDate>
    <dc:creator>ngdnam88</dc:creator>
    <dc:date>2022-12-26T06:36:22Z</dc:date>
    <item>
      <title>Help: Run PowerShell Command in API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-run-powershell-command-in-api/m-p/11641645#M28824</link>
      <description>&lt;P&gt;Dears,&lt;/P&gt;&lt;P&gt;I have this PowerShell command. Please help me how to input to VS.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(Get-Content "D:\Settings.ini") | ForEach-Object { $_ -replace 'OPENAFTEREXPORT=false','OPENAFTEREXPORT=true' } | Set-Content "C:\Settings.ini"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I'm trying with this way:&lt;/P&gt;&lt;P&gt;Put above command line to .ps1 file then open it with these code:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Script = "R:\Testing.ps1"
Shell("PowerShell.exe " &amp;amp; """" &amp;amp; Script &amp;amp; """", vbNormalFocus)&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;Script = "R:\Testing.ps1"
Process.Start("PowerShell.exe", Script)&lt;/LI-CODE&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Mon, 26 Dec 2022 06:36:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-run-powershell-command-in-api/m-p/11641645#M28824</guid>
      <dc:creator>ngdnam88</dc:creator>
      <dc:date>2022-12-26T06:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Run PowerShell Command in API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-run-powershell-command-in-api/m-p/11642434#M28825</link>
      <description>&lt;P&gt;I converted this code from &lt;A href="https://duanenewman.net/blog/post/running-powershell-scripts-from-csharp/" target="_blank" rel="noopener"&gt;this site&lt;/A&gt; to VB.net maybe it is some help to you:&lt;/P&gt;
&lt;LI-CODE lang="visual-basic"&gt;Dim ps1File = "C:\my script folder\script.ps1"
Dim startInfo As New ProcessStartInfo()
startInfo.FileName = "powershell.exe"
startInfo.Arguments = String.Format("-NoProfile -ExecutionPolicy unrestricted ""{0}""", ps1File)
Process.Start(startInfo)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;I just tested that it starts Powershell. Not sure if it will run your script correctly.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Dec 2022 20:49:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-run-powershell-command-in-api/m-p/11642434#M28825</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2022-12-26T20:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: Help: Run PowerShell Command in API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/help-run-powershell-command-in-api/m-p/11643233#M28826</link>
      <description>Great! I got it. Thanks</description>
      <pubDate>Tue, 27 Dec 2022 10:02:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/help-run-powershell-command-in-api/m-p/11643233#M28826</guid>
      <dc:creator>ngdnam88</dc:creator>
      <dc:date>2022-12-27T10:02:30Z</dc:date>
    </item>
  </channel>
</rss>

