I am creating a Windows batch file with a function that takes a variable number of arguments. When I call this batch file the string that I am passing to it contains the special character %.
Prior to calling this function I set a variable containing the string (which contains the special character) and call the function as follows:
SETLOCAL ENABLEDELAYEDEXPANSION
...
SET "MYSTRING=Hello "%%V""
ECHO My String=!MYSTRING!
CALL :BATCH_FUNCTION !MYSTRING!
GOTO :EOF
Here is my batch function definition:
:BATCH_FUNCTION
SET "ARGS=%*"
ECHO Arguments=!ARGS!
GOTO :EOF
The problem I am running into is the % sign is getting stripped out inside the function.
Here are the outputs to demonstrate:
My String=Hello "%V"
Arguments=Hello "V"
Can anyone tell me how to setup either the function arguments or the function itself to not strip off the % sign?
Thank you.