views:

367

answers:

1

Hello, I have a batch script that takes arguments from the command line. One of the arguments has a * in it. In spite of putting the argument in quotes, the * gets expanded before the argument gets used in the batch script.

I am using the following code to parse the arguments:

set CMDLINE_ARGS=%~1
shift 
:get_args 
if "%~1" == "" goto execute
set CMDLINE_ARGS=%CMDLINE_ARGS% %~1
shift
goto :get_args

This works on Windows Server 2003 but not on Server 2008 for some reason. Any help will be appreciated. Thanks.

A: 

It has been a long time since I did anything like this but take a look at

  SETLOCAL ENABLEDELAYEDEXPANSION

Not sure what Windows Server 2008 defaults to.

Jeff Widmer
Won't change anything if it works on one system and not on the other one. Besides, that's not a `for` loop.
Joey