👤
Home Man
Search
Today's Posts
Register

All Windows and DOS questions should go here as well. Discuss UNIX to Windows (Desktop or Server) here!

Validation in user input in batch script

👤 Login to reply

 
Thread Tools Search this Thread
# 1  
Old 02-04-2013
Validation in user input in batch script

I need to insert the validation in my batch script.When user enter the value it should be numeric+minimum length should be
Code:
2

for e.g.
Code:
02,03

if he puts
Code:
1a,1A,2a3

t hen should print the message that it is wrong and print te message enter valid value.

Code:
 
Echo RC is in format of 02
set  /p RC="enter RC Number Please : "
Echo Release Count is : %RC%

Moderator's Comments:
Validation in user input in batch script Moved to Windows & DOS

Last edited by radoulov; 02-04-2013 at 08:35 AM..
# 2  
Old 02-04-2013
To check if numeric:
Code:
SET /A EV=RC
if %EV% EQU %RC% (
	echo Numeric
) else (
	echo Non-numeric
)

To compute length:
Code:
echo.%RC%>len
for %%a in (len) do set /a len=%%~za -2
echo %len%

# 3  
Old 02-07-2013
Thanks for your kind Support
👤 Login to reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Input Email ID Validation senthil.ak UNIX for Dummies Questions & Answers 1 04-24-2014 07:58 PM
Put the numeric validation in user input when value is 5.1.2.3 anuragpgtgerman Windows & DOS: Issues & Discussions 1 02-26-2013 05:05 PM
Script interacts with user , based on user input it operates only4satish Shell Programming and Scripting 7 11-15-2012 01:12 PM
perl: How to improve with minimal validation of its input?? 300zxmuro Shell Programming and Scripting 1 04-18-2012 11:34 PM
Input validation of file sam_bd Shell Programming and Scripting 16 10-19-2011 12:43 PM
Input Validation of comma separated values LinuxRacr Shell Programming and Scripting 5 05-25-2011 04:16 PM
how to do validation the input requirement with if/else wingcross Shell Programming and Scripting 5 01-12-2011 11:18 PM
Command line user input validation pyscho Shell Programming and Scripting 4 10-16-2010 08:49 PM
User Prompt during batch script process bond007jlv Shell Programming and Scripting 2 11-30-2006 02:12 PM
Input validation ? systemali Shell Programming and Scripting 9 03-27-2006 03:58 AM


All times are GMT -4. The time now is 10:30 AM.

Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
×
UNIX.COM Login
Username:
Password:  
Show Password





Not a Forum Member?
Forgot Password?