How to call a batch having carets ?
Posted: 19 Nov 2011 10:05
A Forum all about DOS Batch
https://www.dostips.com/forum/
Code: Select all
call "a ^^ b.bat"
Hum... this is trying to call "a ^^^^ b.bat", as call command escapes caretsEd Dyreen wrote:Code: Select all
call "a ^^ b.bat"
Code: Select all
set "bat_file=a ^ b.bat"
call "%bat_file:^="^^"%"
:: or
set "bat_file2=%bat_file:^="^^^^"%"
call "%bat_file2%"
Code: Select all
call "a "^^" b.bat"
Code: Select all
set "file=a ^ b.bat"
call "%%file%%"
colargol wrote:call seems to escape ^ only if they are surrounded by quotes.
Code: Select all
CALL echo caret^^ "^^"
Phase2 Special characters
-> CALL echo caret^ "^"
....
Phase8 Call Restart parser, doubling all carets
-> echo caret^^ "^^"
...
Phase2 Special characters
-> echo caret^ "^^"
Code: Select all
Of course it helps!jeb wrote:hope it helps
Code: Select all
escape tests a%b&c^d!é'f)g(h=i`j~k%%l&&m^^n!!o.bat
Code: Select all
set "file=!file:%%=%%%%!"
Code: Select all
set "file=a ^ b.bat"
set "arg1=this ^ works"
set "arg2=perfectly ^^"
call "%%file%%" "%%arg1%%" "%%arg2%%"