Tip & How-To about Computers & Internet

How to use the set command as a substitute for the choice command in W2K an XP

The choice command from Win95 can't be used in WinXP or W2K you need to use the SET CHOICE = and the IF'%CHOICE%'== command here is the same example for Win95 example with the CHOICE and ERRORLEVEL commands.

Example One: (Win95)

In the below example a user would be prompted to enter an option of y,n, or Q to print you have selected YES , NO, or QUIT.

CHOICE /N /C:ynQ Select (y,n or Q)? %1

To add more choices increase the errorlevel number and append to the ynQ on the choice command

Example 2: (WinXP and W2K)

In the below example a user would be prompted to enter an option of y,n, or Q to print you have selected YES , NO, or QUIT.

@echo off
set choice=
set /p choice=Type (y,n or Q)?
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='y' goto yes
if '%choice%'=='n' goto no
if '%choice%'=='Q' goto quit
echo "%choice%" is not valid please try again
goto start
echo you have selected YES
goto end
echo you have selected NO
goto end
echo you have selected QUIT
goto end

To add more options simply add another if '%choice%'== goto line and give it a name and add the colon to the front of the name.

Hope this helps took me a whole night to work it out for Windows XP I like the way it works its much easier to understand when you don't have to use the ERRORLEVEL.

N.B> I have used 3 options Y,N or Q you don't have to and the choice I have kept simple you can copy this code and add your own replace the (you have selected YES) with whatever you require to happen if the user presses Y.

Posted by on

Computers & Internet Logo

Related Topics:

Related Questions:

3 Answers

how do i set time and date on my blood pressure monitor

Hello, I do not what device you need to set, but I found for you just an example.

Oct 31, 2018 | Time Computers & Internet

2 Answers

my monitor goes to slpeep and can't make it to come back

  1. Click on the Windowsmag-glass_10x10.gif Start menu and go to Control Panel.
  2. Step 2 Click the "Power Options" choice located inside Windows Control Panel. The choices are listed in alphabetical order. A photo example of this button is located within this article.
  3. Step 3 16773_65x95_aspect.jpg Power Options Properties Dialog Box in Microsoft Windows Click on the first drop down box, which displays "portable" or "desktop" types of power scheme choices. Select the one that best suits your computer use even if it is not a desktop or laptop. Doing this will not adversely affect your computer.
  4. Step 4 16778_65x95_aspect.gif Turn off monitor time options example menu Click on the "Turn Off Monitor" options and select your desired time limit from the drop down box. You can feel free to select "never" for this choice and any of the others. One column displays "Running on Batteries" while the other displays "plugged in options." Your selections can be different for each. Make your choices according to your use and preferences of your own computer. A photo example is shown within this article.
  5. Step 5 16781_65x95_aspect.jpg Turn off Hard disks example Click the "Turn off Hard Disks" choice if you would like to change the timing of that.
  6. Step 6 16782_65x95_aspect.jpg System Standby choices Click on "System Standby" and make any changes to the time limits as needed. This is optional. It may be best to select "never" or at least a few hours for this choice.
  7. Step 7 16785_65x95_aspect.gif System Hibernate Click "System Hibernates" if you wish to have your computer hibernate (or "sleep") after a certain length of time. This again is entirely optional and not required. When you are finished, click "OK" to save all of your choices. This is very important.

Dec 02, 2009 | Dell Dimension 4600 PC Desktop

2 Answers

ADMINISTRATOR account disabled

Boot your computer into Safe Mode. It sometimes varies, but the typical way on most WinXP

based machines is to strike the F8 key during P.O.S.T. Once the drivers load you need to


PROMPT. A new window will appear.

At command prompt, type "control userpasswords2" and press Enter to open the Windows 2000-style User Accounts application.

On the Users tab, clear the Users Must Enter A User Name And Password To Use This Computer check box and then click OK.

In the Automatically Log On dialog box that appears, type the user name and password for the account you want to be
logged on each time you start your computer.

Nate P.

Jan 29, 2009 | Computers & Internet

1 Answer

install my scanner with winXP

In a word you cannot. Try the Acer site to see if they offer a suitable software conversion- but this late on it is not likely. You could try/Start/Programs/Accessories/Compatibility Wizard- then set the software you use to 'Run as 95/98 - it may work. What it amounts to is this- A scanner has its own processor that controls the scan tracking the capture device DPI and all that and in your case it is looking for DOS commands and XP is sending out NTFS commands - and they no speak to each other.

May 09, 2007 | AcerScan Prisa 340P Flatbed Scanner

Not finding what you are looking for?

1,069 people viewed this tip

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Les Dickinson
Les Dickinson

Level 3 Expert

18429 Answers

Alun Cox

Level 3 Expert

2678 Answers

David Payne
David Payne

Level 3 Expert

14162 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions