I have the following script:
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
SET /A countArgs=1
FOR %%p in (%pathListToCheck%) DO (
IF NOT EXIST %%p (
CALL :error "!countArgs!. Argument -> bla!"
EXIT /B 1
)
SET /A countArgs+=1
)
:error
ECHO ERROR
set x=%~1
ECHO !x!
EXIT /B 0
Unfortunately the exclamation mark does not get echo
d. I also tried to escape it like ^!
and ^^!
but it doesn't work.
I use delayed expension here to make the greater-then sign (>
) work. If i would try to ECHO the parameter directly (ECHO %~1
) it would fail. For details see my previous question
How can fix this?
I appreciate your help...