Passing parameter syntax

I need to execute a program. Â The program has a switch that I need to pass to it. Â The switch is throwing everything off. Â I tried looking through the help and did not notice any options.

invoke-item "c:\test\text.exe"

I need to pass the switches /I and /Q

If there is a better way to accomplish outside of using invoke-item, I'm fine with that.

You don’t need Invoke-Item.

c:\test\text.exe /I /Q

Should work fine. If it doesn’t, and you’re using PowerShell 3, consider using the “stop parsing the rest of this line” operator:

c:\test\text.exe %-- /I /Q

(from http://technet.microsoft.com/en-us/library/hh847892.aspx)

[quote=7894]You don’t need Invoke-Item.
<pre class=“d4pbbc-pre”>c:\test\text.exe /I /Q
Should work fine. If it doesn’t, and you’re using PowerShell 3, consider using the “stop parsing the rest of this line” operator:
<pre class=“d4pbbc-pre”>c:\test\text.exe %– /I /Q
(from http://technet.microsoft.com/en-us/library/hh847892.aspx) [/quote]

Don, that works perfectly thank you. Â Is there some trick to getting it to work when spacing is applicable? Â For example:

c:\test\test.exe works perfectly

c:\program files\test 1\test.exe does not work. Â Enclosing it in single quotes or double quotes is not doing anything.

When spaces are involved, you need to use the invoke operator (&):

& “C:\Program Files\Some.exe” …

I just had my Ah Ha moment! Â Thank you :slight_smile: