Calling a batch file with arguments having quotes -
i have batch file test.bat , takes 2 arguments commandline.
arg1 - "c:\work area\" arg2 - "hello politics="hero jack""
i have test.bat calling as
test.bat "c:\work area\" "hello politics="hero jack""
i want second argument taken bat file hello politics="hero jack"
. dont know how call test.bat argument such happens so.. second argument takes "hello politics="hero
, discards jack"
. can let me know calling wrongly..
in opinion, not possible 1 parameter
arg2 - "hello politics="hero jack""
it's because paramter tokenizer not interested in carets. seems, tokenizer count quotes.
the parser detects carets , can escape special characters & > or <
tokenizer split line %1,%2 parameters use rule. delimiter , ; = starts new parameter, can suppressed, if there unequal count of quotes before
test.bat """this 1 param" test.bat ""these 4 params" test.bat ^"this 1 param" test.bat ^^"this 1 param"
but can use workaround, like
test.bat "c:\work area\" "hello politics=""hero jack""
this creates in %2 "hello politics=""hero jack""
can replace double quotes single quote.
Comments
Post a Comment