I want to invoke a batch file with a comma-delimited paramater. How can I achieved this?
I want it like this example.
I have a text.bat with the script:
@echo off
set test=%1
echo Sample %test% batch.
I want to run the batch like this:
c:\text.bat this,is,sample
and I am expecting a result like this:
Sample this,is,sample batch.
Any idea how I could achieve this?
Thanks.
Wow! I didn’t know commas behaved that way.
You have two options.
You can use this script:
And run it with:
The
%~1represents the first argument without quotes. The quotes group the comma-delimited list as a single argument.Or
You can use this script:
And run it with:
The
%*represents the command line arguments as they were typed.