I'm in the unfortunate position to be forced to invoke a program via echo <input> | program.exe
. Of course, I wondered how to escape <input>
and found:
- How does the Windows Command Interpreter (CMD.EXE) parse scripts?
- Escape angle brackets in a Windows command prompt
In essence, it seems sufficient to escape all special chars with ^
. Out of curiosity I still would like to know, why echo ingores double-quote escaping in the first place:
C:\>echo "foo"
"foo"
C:\>
Is there any normative reference?
Bonus question: How to echo the strings on
and off
with the echo command?
Edit: I just found this. I states that only |<>
need to be escaped. However, expansion like %FOO%
still work.