Reputation: 111
I am calling a batch file like this:
test.bat C:\
The C:\
parameter is passed to a command within the batch file like this:
start program.bat "%1"
I am finding that program.bat
is starting like this:
program.bat "C:\"
Is it possible to remove the enclosing quotation marks from the parameter so that program.bat
receives C:\
instead of "C:\"
?
Upvotes: 3
Views: 619
Reputation: 77657
%1
evaluates to the first parameter as-is. That is, if the parameter is enclosed in quotation marks, they will be preserved.
%~1
strips the quotation marks before evaluating.
So, use %~1
in program.bat
where you need to use the value of the first parameter without quotation marks.
Upvotes: 3