An integer is a whole number, like 0, or 9, or 1234.
The basic syntax used to determine if a variable or parameter is an integer is:
if VariableOrParameter EQU +VariableOrParameter CommandToExecuteIfInteger
Samples:if %1 EQU +%1 @echo %1 is an integer.
if %1 NEQ +%1 goto error
if %var% EQU +%var% @echo Variable var contains an integer.
For /f "Tokens=*" %%a in ('type %1') do (
if %%a NEQ +%%a @echo Line containing \{%%a\} in file %1 is NOT an integer.
)
0 comments
Hide comments