I have a batch file test.bat and it takes 2 arguments from 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 the second argument to be taken by bat file as Hello politics="Hero Jack"
. I dont know how to call the test.bat with argument such that it happens so..
The second argument it takes is like "Hello politics="Hero
and it discards the Jack"
. Can you let me know what I am calling wrongly..
In my opinion, it is not possible to get it as one parameter
Arg2 - "Hello politics="Hero Jack""
It's because the paramter tokenizer is not very interested in carets. It seems, that the tokenizer count only quotes.
The parser detects carets and can escape special characters like & > or <
But the tokenizer who split the line into the %1,%2 parameters use the rule.
A delimiter like , ; = starts a new parameter, this can only suppressed, if there is an unequal count of quotes before
test.bat """This is one param"
test.bat ""These are four params"
test.bat ^"This is also one param"
test.bat ^^"This is also one param"
But you can use a workaround, like
test.bat "C:\work Area\" "Hello politics=""Hero Jack""
This creates in %2 "Hello politics=""Hero Jack""
Then you can replace all double quotes with a single quote.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With