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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.