how to stop powershell mangling command line options for program executed from shell?

Posted by kem on Super User See other posts from Super User or by kem
Published on 2011-02-09T14:01:29Z Indexed on 2011/02/09 15:27 UTC
Read the original article Hit count: 233

Filed under:
|
|
|
|

From the powershell prompt, when I try to run a program and feed it a command line option, powershell ends up mangling the option. Why does this happen? Is there any way to stop it besides enclosing the option in quotes?

For example, from the powershell prompt:

PS Microsoft.PowerShell.Core\FileSystem::\\mach\share> .\myprog.exe -file=input.txt

myprog.exe ends up getting two arguments:

1) -file=input
2) .txt

I need to run it like:

.\myprog.exe "-file=input.txt"

or

.\myprog.exe '-file=input.txt'

to force it to be one argument. No other shell does this.

© Super User or respective owner

Related posts about shell

Related posts about powershell