How to echo >>someText in a Windows batch file

2020-04-26 23:18发布

问题:

I want to print to the console the exact text ">>someText"

I try

echo abb >>"cdd eee"

but that will print nothing and create file cdd with abb text inside it.

What syntax should I go with echo for that?

回答1:

you have to "escape" special chars like > with a caret ^:

echo abb ^>^>"cdd eee"


回答2:

Use quotes

echo ">> cdd"


回答3:

Use carat to escape the characters echo ^>^>your text

C:\echo ^>^>"cdd eee"
>>cdd