简体   繁体   中英

Is there a way to turn off script parsing in PowerShell and execute commands with raw arguments?

I'm trying to pass raw arguments to commands through PowerShell but it's failing. PowerShell tries to evaluate the arguments before they get passed to commands and as a result the commands get the wrong arguments. Does anyone know if there is a mode in PowerShell that would treat commands and arguments as they're typed? Alternatively, does anyone know the PowerScript quoting rules so I can escape the parts that it tries to evaluate?

If you are using PowerShell V3 then use the new --% operator eg:

tf.exe status --% /workspace:workspacename;*

Everything after --% until the end of the line is not evaluated by PowerShell. It behaves kind of like cmd.exe in this zone. For more info on --% see this blog post .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM