A very simple but efficient method I use when I need a non-zero numeric input is the following code (note that this verifies the user entry afterwards):
:RETRY_RESET
rem /* Since zero is considered as invalid, preset variable to `0` to
rem not keep the former value in case the user just presses ENTER;
rem you could also define a non-zero default value here optionally: */
set /A NUMBER=0
:RETRY_REUSE
rem // Display prompt now:
set /P NUMBER="Please enter a positive number: "
rem /* Convert entry to a numeric value; everything up to the first
rem numeral is converted to a numeric value, except leading SPACEs
rem or TABs are ignored and signs `+` and `-` are recognised: */
set /A NUMBER+=0
rem /* Caution: numbers with leading `0` are converted to octal ones!
rem since `8` and `9` are not valid octal numerals, entries with
rem such figures and leading zeros are converted to `0`! */
rem // Verify entry:
if %NUMBER% EQU 0 goto :RETRY_RESET
rem // Do something with `%NUMBER%` at this point...
rem /* Afterwards you can jump to `:RETRY_RESET` to enter another number;
rem alternatively, jump to `:RETRY_REUSE` to maintain the former entry
rem in case the user just presses ENTER... */
This will not fail for any entry you can think of because the variable NUMBER holding the value is never expanded before it is converted to a true number by set /A NUMBER+=0.
The script recognises + and - signs correctly. Leading white-spaces are ignored. Besides all those, everything up to the first non-numeric figure is converted to a number; so for instance, an entry like SPACE+15.75k is converted to 15 as the . is not a numeral.
The disadvantage of this approach is that leading zeros may lead to unexpected results as set /A interpretes numbers with such as octal ones; so for instance, 012 is converted to (decimal) 10, and 08 and 09 are converted to 0 as 8 and 9 are not valid octal digits.
A good point though could be the fact that hexadecimal numbers are recognised correctly in case they are prefixed with 0x; for example, 0x18 is converted to 24; 0xAS becomes 10 (as S is not hex.).