I need to check if a parameter that is passed to a Windows Batch file is a numeric value or not. It would be good for the check to also works for variables.
I found a
You could try this. The variable passed is for example var and %var% is equal to 500.
set /a varCheck=%var%
if %varCheck% == %var% (goto :confirmed) else (exit /B)
exit /B
:confirmed
:: You can use %var% here, and it should only be executed if it is numerical!
if %var% is equal to e.g. a3453d, then it would set varCheck to be 0, and because 0 is not equal to a3453d, then it will exit batch processing.
(The exit on line 3 is just in case the if statement decides not to execute for some reason ... XD.)