Computing.Net > Forums > Disk Operating System > Batch File.....CHOICE command in XP

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch File.....CHOICE command in XP

Reply to Message Icon

Name: ffxifanatic
Date: September 13, 2003 at 09:16:14 Pacific
OS: WindowsXP HOme Editition
CPU/Ram: 256DDR
Comment:

I am running XP but i need a batch file that uses something like the choice command available in 98. Is there another command like it in XP that i can use....for example i want to be able to do the following:
choice/c:123456 %1
if errorlevel 6 GOTO VERIFY
if errorlevel 5 GOTO NO5
if errorlevel 4 GOTO NO4
if errorlevel 3 GOTO NO3
if errorlevel 2 GOTO NO2
GOTO NO1
but i always get a looping message saying choice is unknown batch file command.....



Sponsored Link
Ads by Google

Response Number 1
Name: Nathan
Date: September 13, 2003 at 11:28:49 Pacific
Reply:

yes its called set /p. I'm going to keep this brief so just copy this code

@echo off
:start
cls
set /p userinp=choose a number(1-6):
set userinp=%userinp:~0,1%
if "%userinp%"=="1" goto 1
if "%userinp%"=="2" goto 2
if "%userinp%"=="3" goto 3
if "%userinp%"=="4" goto 4
if "%userinp%"=="5" goto 5
if "%userinp%"=="6" goto 6
echo invalid choice
goto start
:1
(do stuff here)
goto end
:2
(do more stuff here)
goto end
:3
stuff
goto end
etc.
:end
pause>nul



0

Response Number 2
Name: ffxifanatic
Date: September 13, 2003 at 19:20:02 Pacific
Reply:

Will this command also work in Windows98? My problem is the school has Win98 and I have XP. If this command works for both that's even better.
thx:)


0

Response Number 3
Name: Nathan
Date: September 13, 2003 at 21:21:44 Pacific
Reply:

no set /p is only avialable for the NT family I believe(dont quote me). another option would be to dualboot you HD so for school work you can launch win 98. another option would be to "take" the windows 98 choice command and put it into xp.


0

Response Number 4
Name: ffxifanatic
Date: September 13, 2003 at 23:48:39 Pacific
Reply:

Ok, i like taking the choice command option.....any idea how i can do that?
thx:)


0

Response Number 5
Name: IVO
Date: September 14, 2003 at 06:14:01 Pacific
Reply:

To take the "Choice" command from Windows 98 simply locate it (it is likely stored in C:\windows\command directory), send it to a floppy and then load it into the directory where you save your batch files in Windows XP.
It is not a true legal procedure, but I think Bill Gates may tolerate that.


0

Related Posts

See More



Response Number 6
Name: Nathan
Date: September 14, 2003 at 13:50:20 Pacific
Reply:

couldnt have said it better mysely. thanks IVO


0

Response Number 7
Name: MargaretB
Date: September 17, 2003 at 09:02:46 Pacific
Reply:

I'm trying to do something similar in XP, where I want the user to type in a filename for a .PRN file and then have the batch file send the .PRN file to the printer. Using the example above, I get the prompt I wanted, but the program does not appear to "take in" the input. I type the filename, nothing appears, and the program doesn't move on to the next step. I'm stuck there. Is there a different format required for inputting a string rather than a one-character number?

Thanks.


0

Response Number 8
Name: ffxifanatic
Date: September 17, 2003 at 10:17:05 Pacific
Reply:

yup, i moved it over to XP and nothings going wrong now. Thx to Nathan and IVO for that.

sorry MargaretB, i have no idea....but im gonna guess its got to do something with quotes.


0

Response Number 9
Name: Nathan
Date: September 17, 2003 at 17:45:38 Pacific
Reply:

hey margeret, post the batch file your useing


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Batch File.....CHOICE command in XP

Choice in batch files on NT4-DOS www.computing.net/answers/dos/choice-in-batch-files-on-nt4dos/11474.html

how to find OS in batch file www.computing.net/answers/dos/how-to-find-os-in-batch-file/11085.html

How to find CD-ROM letter in batch file? www.computing.net/answers/dos/how-to-find-cdrom-letter-in-batch-file/8766.html