Name: ffxifanatic Date: September 13, 2003 at 09:16:14 Pacific Subject: Batch File.....CHOICE command in XP 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.....
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
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.
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.
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?
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE