I'm trying to make sure the user of the batchfile is inputing a 6 digit numbers only. No more no less and only numbers.
I found the code bellow in this thread but can't figure how to modify it for my need.
Reference code
:Prompt
SET /P "UserInput=Please Enter Version as X.X.X.X: "
FOR /F "TOKENS=1-4 DELIMS=." %%i IN ("%UserInput%") DO (
SET /A n1=1*%%i
SET /A n2=1*%%j
SET /A n3=1*%%k
SET /A n4=1*%%l
)
IF NOT "%UserInput%" == "%n1%.%n2%.%n3%.%n4%" GOTO :Prompt
ECHO %UserInput%
I thought that modifying the code like so would do the trick but it does not
My modification to the reference code
:Prompt
SET /P "UserInput=Please Enter Version as XXXXXX: "
FOR /F "TOKENS=1-6" %%i IN ("%UserInput%") DO (
SET /A n1=1*%%i
SET /A n2=1*%%j
SET /A n3=1*%%k
SET /A n4=1*%%l
SET /A n4=1*%%m
SET /A n4=1*%%n
)
IF NOT "%UserInput%" == "%n1%%n2%%n3%%n4%%n5%%n6%" GOTO :Prompt
ECHO %UserInput%
What i'm I doing wrong and i'm I on the right track? Thank you and have a nice day!