PowerShell passing parameter to executable having switches

Question:

i am tring to convert
abc.exe /u “c:/programs/abc.dll” to powershell script can anybody explain how to do it.

how can i execute the *.exe having switches with parameters??

thanks..

Sunny

Answer:

It should be as straight forward as:

However you can run into issues with quoting and other characters that get interpreted by PowerShell. Usually quouting an argument will suffice but if that still doesn’t work you can use Start-Process in PowerShell 2.0 e.g.:

If you have PowerShell Community Extensions installed you can use a utility called echoargs.exe to troubleshoot passing args to exe’s. e.g.:

Echoargs display the arguments exactly as the EXE sees them.

Source:

PowerShell passing parameter to executable having switches by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply