Invoking a Batch File with Quoted Arguments

I have a batch file test.bat and it takes 2 arguments from the command line.

Arg1 - "C:\work Area\"
Arg2 - "Hello politics="Hero Jack""

I have test.bat calling

test.bat "C:\work Area\" "Hello politics="Hero Jack""

I want the second argument to be accepted by the bat file as Hello politics="Hero Jack". I do not know how to call test.bat with an argument so that this happens. The second argument that it takes is similar to "Hello politics="Hero, and it drops Jack". Can you tell me that I am calling incorrectly.

+5
source share
3 answers

In my opinion, it is impossible to get it as one parameter

Arg2 - "Hello politics="Hero Jack""

This is because the parametric tokenizer is not very interested in the map. It seems that the number of tokenizers is only quotation marks.

, , > <
, % 1,% 2, . :; = , ,

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"

,

test.bat "C:\work Area\" "Hello politics=""Hero Jack""

% 2 "Hello policy =" "Hero Jack" "
.

+3
0

, 2. :

test.bat ""C:\work Area\" "Hello politics="Hero Jack"""

: http://ss64.com/nt/syntax-esc.html

0

All Articles