Reputation: 88
I was trying to write multiple lines with a batch file like this->
@echo off
(
echo 123()
echo abc
) > exampleFile
the problem is in the third line of the code:
echo 123()
I think its the closing ).
How to prevent this? Is there any kind of c or c++ like escape characters for the echo command? Thanks for help, true.
Upvotes: 2
Views: 517
Reputation: 175776
Escape with a caret;
@echo off
(
echo 123(^)
echo abc
) > exampleFile
Upvotes: 4
Reputation: 57252
@echo off
setlocal enableDelayedExpansion
set "for_echo=123()"
(
echo !for_echo!
echo abc
) > exampleFile
endlocal
Upvotes: 1