Unix/Linux Go Back    


Windows & DOS: Issues & Discussions 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

Windows & DOS: Issues & Discussions


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 02-04-2013   -   Original Discussion by anuragpgtgerman
anuragpgtgerman's Unix or Linux Image
anuragpgtgerman anuragpgtgerman is offline
Registered User
 
Join Date: Aug 2011
Last Activity: 23 March 2017, 2:26 PM EDT
Location: India
Posts: 96
Thanks: 1
Thanked 1 Time in 1 Post
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 09:35 AM..
Sponsored Links
    #2  
Old Unix and Linux 02-04-2013   -   Original Discussion by anuragpgtgerman
Yoda's Unix or Linux Image
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 10 December 2017, 7:33 PM EST
Location: Galactic Empire
Posts: 3,612
Thanks: 254
Thanked 1,317 Times in 1,234 Posts
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%

Sponsored Links
    #3  
Old Unix and Linux 02-07-2013   -   Original Discussion by anuragpgtgerman
anuragpgtgerman's Unix or Linux Image
anuragpgtgerman anuragpgtgerman is offline
Registered User
 
Join Date: Aug 2011
Last Activity: 23 March 2017, 2:26 PM EDT
Location: India
Posts: 96
Thanks: 1
Thanked 1 Time in 1 Post
Thanks for your kind Support
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script interacts with user , based on user input it operates only4satish Shell Programming and Scripting 7 11-15-2012 02:12 PM
Input validation of file sam_bd Shell Programming and Scripting 16 10-19-2011 01:43 PM
Command line user input validation pyscho Shell Programming and Scripting 4 10-16-2010 09:49 PM
User Prompt during batch script process bond007jlv Shell Programming and Scripting 2 11-30-2006 03:12 PM
Input validation ? systemali Shell Programming and Scripting 9 03-27-2006 04:58 AM



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