The code below demonstrates the issue of passing text that includes an asterisk
to a function and using a For loop to echo the text.
The function args (%*) echo okay, but the For loop ignores text with an asterisk.
Looking for a solution. Thanks.
Code: Select all
@Echo Off
setlocal EnableDelayedExpansion
Call:pFunc "Product List, *=Discontinued"
Call:pFunc "Aisle # & Shelf"
endlocal&goto:eof
rem function
:pFunc
setlocal EnableDelayedExpansion
For %%a In (%*) Do Echo %%~a
endlocal&exit /b