I have the following stript:
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
SET /A countArgs=1
...
SET /A countArgs+=1
CALL :error "!countArgs!. Argument ^-^> bla"
EXIT /B 1
...
:error
ECHO ERROR
ECHO %~1
EXIT /B 0
But the 2. ECHO-line in the :error routine echos nothing. When I reduce the CALL argument string to "!countArgs!. Argument ^-^>" i get a syntax error and when i reduce it to "!countArgs!. Argument ^-" or even "!countArgs!. Argument -" it works properly.
According to this post the character should be escaped when adding a ^ if it is inside quotes which makes sense because when using the string as a parameter in the :error routine the ~ removes surrounded quotes...
How can i fix it?
Appreciate your help.