Passing parameter syntax This topic contains 4 replies, has 3 voices, and was last updated by Lery 3 years, 10 months ago. Author Posts June 26, 2013 at 8:27 am #7891 LeryParticipant 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. June 26, 2013 at 8:46 am #7894 Don JonesKeymaster 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) June 26, 2013 at 9:28 am #7895 LeryParticipant [quote=7894]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] 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. June 26, 2013 at 9:29 am #7896 PoshoholicMember When spaces are involved, you need to use the invoke operator (&): & "C:\Program Files\Some.exe" ... June 26, 2013 at 9:41 am #7897 LeryParticipant [quote=7896]When spaces are involved, you need to use the invoke operator (&): & â€œC:\Program Files\Some.exeâ€ â€¦ [/quote] I just had my Ah Ha moment! Â Thank you 🙂 Author Posts You must be logged in to reply to this topic.