Asterisk (*) in windows batch file command line argument gets expanded
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 开发者_如何学GoServer 2008 for some reason.
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.
精彩评论