| re: Command Line Argument with & and ^
Alf P. Steinbach wrote:[color=blue]
> * mackmelo:[color=green]
> >
> > I'm sorry, but this is not off-topic. Maybe I didn't explain myself
> > very clearly.[/color]
>
> It is 100% off-topic, and you did explain it very clearly.
>
> It is purely an issue with one specific Microsoft Windows program
> (namely, the Windows program [cmd.exe]), and so has /nothing whatsoever/
> to do with any programming language, much less C++.
>
> Please post to an appropriate newsgroup, such as e.g.
> [comp.os.ms-windows.programmer.win32].[/color]
Brief explanation, as the question is asked.
cmd.exe interprets '^' as an escape character (like '\' in C/C++
strings).
For example, a command
echo hello > world
passes "hello" to echo and forwards its output to a file "world"
To escape control characters of command line, use ^ prefix:
echo hello ^>^^.^^^< my name is Neko
passes "hello >^.^< my name is Neko" to echo and doesn't redirect.
& means serial execution of commands
echo hello & echo world
is treated as
echo hello
echo world
To escape &, use ^ as above. |