DOS Commands
Revision as of 09:40, 17 September 2013 by PeterHarding (talk | contribs) (Created page with "=Handling Arguments= <pre> SET /A ARGS_COUNT=0 FOR %%A in (%*) DO SET /A ARGS_COUNT+=1 </pre> <pre> @echo off setlocal enableextensions enabledelayedexpansion call :...")
Handling Arguments
SET /A ARGS_COUNT=0 FOR %%A in (%*) DO SET /A ARGS_COUNT+=1
@echo off
setlocal enableextensions enabledelayedexpansion
call :getargc argc %*
echo Count is %argc%
echo Args are %*
endlocal
goto :eof
:getargc
set getargc_v0=%1
set /a "%getargc_v0% = 0"
:getargc_l0
if not x%2x==xx (
shift
set /a "%getargc_v0% = %getargc_v0% + 1"
goto :getargc_l0
)
set getargc_v0=
goto :eof