I want to invoke:
"c:\(...)\devenv.com" foo.sln /build "Debug|Win32"
using cmd.exe. In my experience, cmd.exe either strips out the first pair of quotes (causing the executable to not be found) or the second pair of quotes (causing the pipe character to be misinterpreted). How do you pass a quoted pipe character to cmd.exe?
If you need to use any of these characters as part of a command-line argument to be given to a program (for example, to have the find command search for the character >), you need to escape the character by placing a caret (^) symbol before it.
The | command is called a pipe. It is used to pipe, or transfer, the standard output from the command on its left into the standard input of the command on its right.
Escape every double quote " with a caret ^ . If you want other characters with special meaning to the Windows command shell (e.g., < , > , | , & ) to be interpreted as regular characters instead, then escape them with a caret, too.
You can either do it the way you are doing there, enclosing the string with the |
in quotation marks.
Or you can escape it with the circumflex accent ^
:
"c:\(...)\devenv.com" foo.sln /build Debug^|Win32
As a side note: Why are you building this with DevEnv instead of MSBuild?
The caret (^) character is special shell characters to escape character for things like <, >, (, ), ...
cmd/c "echo Hello ^" World"
Output
Hello " World
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With