TechTalkz.com Logo Ask the Experts!

Go Back   TechTalkz.com Technology & Computer Troubleshooting Forums > Software World > Programming

String manipulation on command prompt help

Programming

 
Reply
Thread Tools Display Modes
Unread 28-07-2013, 11:46 AM   #1
Newbie
Thread Starter
 
Join Date: Jul 2013
Age: 24
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Mood: Asleep
Rep Power: 0 rbin23 is an unknown quantity at this point

Intel Nvidia

Windows 7


Question String manipulation on command prompt help

Hi I'm new here and also new to command prompt...
so I was trying to create a program like this:

*Enter number from 0-9$
You entered:$
The number you entered is:$
Do you want to try again?(Y/N):$
NOTE: if Y or y, prompt to *
if N or n,exit
if not from the choices, display "INVALID"
if value entered is not a number or it is greater/less than 0-9 display "INVALID" prompt to *

any advice would help, I,m still using TASM and tlink
and i'm using the LEA format with looping etc...

Sponsored Links
rbin23 is offline   Reply With Quote
Unread 28-07-2013, 10:11 PM   #2
Newbie
 
Join Date: Jul 2013
Posts: 12
Thanks: 0
Thanked 2 Times in 2 Posts
Mood: Confused
Rep Power: 0 Yi18 is an unknown quantity at this point

Intel Nvidia

Windows 8


Re: String manipulation on command prompt help

:A
Echo off
Echo Enter number from 0-9
set /p Number1=
if %Number1%==0 goto B
if %Number1%==1 goto B
if %Number1%==2 goto B
if %Number1%==3 goto B
if %Number1%==4 goto B
if %Number1%==5 goto B
if %Number1%==6 goto B
if %Number1%==7 goto B
if %Number1%==8 goto B
if %Number1%==9 goto B

:B
echo The Number you entered is %number1%
echo Do you want to try again? (Y/N)
set /p yn=
if %yn%==Y goto A
if %yn%==y goto A
if %yn%==Yes goto A
if %yn%==yes goto A
if %yn%==N goto error
if %yn%==No goto error
if %yn%==n goto error
if %yn%==no goto error
Yi18 is offline   Reply With Quote
Thanked Users:
chrisya3 (02-12-2014)
Unread 28-07-2013, 10:16 PM   #3
Newbie
 
Join Date: Jul 2013
Posts: 12
Thanks: 0
Thanked 2 Times in 2 Posts
Mood: Confused
Rep Power: 0 Yi18 is an unknown quantity at this point

Intel Nvidia

Windows 8


Re: String manipulation on command prompt help

Unsure how to do the thing where they goto invalid, I tried

:A
Echo off
cls
Echo Enter number from 0-9
set /p Number1=
if %Number1%==0 goto B if NOT goto Z
if %Number1%==1 goto B if NOT goto Z
if %Number1%==2 goto B if NOT goto Z
if %Number1%==3 goto B if NOT goto Z
if %Number1%==4 goto B if NOT goto Z
if %Number1%==5 goto B if NOT goto Z
if %Number1%==6 goto B if NOT goto Z
if %Number1%==7 goto B if NOT goto Z
if %Number1%==8 goto B if NOT goto Z
if %Number1%==9 goto B if NOT goto Z

:B
echo The Number you entered is %number1%
echo Do you want to try again? (Y/N)
set /p yn=
if %yn%==Y goto A
if %yn%==y goto A
if %yn%==Yes goto A
if %yn%==yes goto A
if %yn%==N goto error
if %yn%==No goto error
if %yn%==n goto error

:Z
echo INVALID
timeout 2 /nobreak
goto A
if %yn%==no goto error



Didn't work
Yi18 is offline   Reply With Quote
Thanked Users:
chrisya3 (02-12-2014)
Unread 29-07-2013, 12:48 AM   #4
Newbie
Thread Starter
 
Join Date: Jul 2013
Age: 24
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Mood: Asleep
Rep Power: 0 rbin23 is an unknown quantity at this point

Intel Nvidia

Windows 7


Re: String manipulation on command prompt help

Sponsored Links
thx Yi18 i will try this...

Sponsored Links
rbin23 is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Batch file help - string manipulation bru Windows XP 3 06-03-2008 09:13 PM
Command prompt "COPY" command not working in brand new Windows Vis CMD COPY command not working in Vista Windows Vista All 7 05-02-2008 10:12 PM
String manipulation syntax db Microsoft SQL Server 11 29-11-2007 09:31 PM
String manipulation BobAchgill VB.NET 6 22-10-2007 05:03 PM
Command Prompt Barry Windows Security 8 28-08-2007 06:30 AM


< Home - Windows Help - MS Office Help - Hardware Support >


New To Site? Need Help?

All times are GMT. The time now is 12:00 PM.


vBulletin, Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © 2005-2016, TechTalkz.com. All Rights Reserved - Privacy Policy
Valid XHTML 1.0 Transitional