I'm looping through all command-line arguments using SHIFT
. I'm getting result of ECHO is off.
. It is likely printing the empty variable.
:argLoopStart
SET paramName=
SET arg=%1
IF -%arg%-==-- GOTO argLoopEnd
IF %arg:~0,2%==-- (
SET paramName=%arg%
ECHO %arg%
ECHO %paramName%
)
SHIFT
GOTO argLoopStart
:argLoopEnd
By running the command fake-command --dbs=mydbname
, I got this:
--dbs
ECHO is off.
According to the code above, ECHO %arg%
prints --dbs
and ECHO %paramName%
prints ECHO is off
. The line of SET paramName=%arg%
is not working as I expected. %parameName%
should print --dbs
as well. However, it seems printing an empty variable.