Posted by SpywareDr on August 29, 2009 at 11:30:59:
In Reply to: Dos: Passing an argument with a comma in posted by Oliver C on August 26, 2009 at 03:44:15:
: I'm tyring to pass an argument from the command
: prompt which has a comma in. The problem is
: that a comma can be used to separate two
: arguments. I'm using XP and using double quotes
: around the argument doesn't seem to work
: either.
: The batch file i'm using finds a string (arg1)
: and replaces it with another string (arg2) e.g.
: find 2090 and replace with 2090,2091
: Any ideas?
--
As a test, create a batch file named "c:\test.bat" with the following single line in it:
@echo %1
Now get to a C:\> prompt and type:
test "2090,2091"
The response you get back from test.bat should be:
"2090,2091"
If you do not want the quotes, use the following single line (instead of the above):
@for %%I in (%1) do echo %%~I
Now get to a C:\> prompt and type:
test "2090,2091"
The response you get back from test.bat should be:
2090,2091