How to check if a parameter (or variable) is a number in a Batch script

SET "var="&for /f "delims=0123456789" %%i in ("%1") do set var=%%i
if defined var (echo %1 NOT numeric) else (echo %1 numeric)

Replace %1 with %yourvarname% as appropriate

Leave a Comment