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
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.....
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
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
Summary: I wrote a batch file with the CHOICE command in it but whenever the program gets to that command I get an error saying "the specified name is not recognised as an internal or external command." the sa...
Summary: NT systems have the %OS% variable set by default to 'Windows_NT', and non-NT systems don't. So, if you just want to act depending if the OS is NT (Win NT4,2000,XP) or non-NT (Win9x, Dos 6.22), this wi...
Summary: For The Doofus Thanks. I did it. But... WinMe Too many parameters - Ž Too many parameters Invalid drive specificat Bad command or file name Bad command or file name WinXP The syntax of the command is...