Computing.Net > Forums > Programming > Batch File Menu 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 Menu in XP

Reply to Message Icon

Name: smokey99
Date: September 15, 2008 at 08:39:18 Pacific
OS: XP
CPU/Ram: n/a
Product: n/a
Comment:

I've been working on a batch file that among other things prompts the user to make a menu selection. I've been using the standard "set /p " command since I'm on XP and choice doesn't exist. Unfortunately, I'm finding that many of the options that I liked about choice don't seem possible with the 'set' command.

Is there any way to give the user say 5 seconds to respond and if they don't, then choose a default item from the menu?

Thanks in advance.

Smokey.

P.S. M2, I've used a ton of your examples so far to make the overall batch file. Thanks a million for all the help you've given others on this site. Much appreciated.



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: September 15, 2008 at 10:48:32 Pacific
Reply:

"Is there any way to give the user say 5 seconds to respond and if they don't, then choose a default item from the menu?"

Not that I know of.

I thought CHOICE was included in XP.

Thanks for the encouragement.


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 2
Name: toast (by NoIdea)
Date: September 15, 2008 at 11:19:12 Pacific
Reply:

Can get choice.com from here
http://www.daniel-hertrich.de/wwwlx...
I'll encourage you as well M2.


0

Response Number 3
Name: Mechanix2Go
Date: September 15, 2008 at 11:32:52 Pacific
Reply:

If you prefer English:

http://golden-triangle.com/CHOICE.COM


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 4
Name: worldlibrary
Date: September 15, 2008 at 12:33:16 Pacific
Reply:

http://www.ss64.com/nt/timeout.html

Think out of the box.

Use the command and a goto label
__________________________________
Below is just a snipit

cls
@echo off
echo.
echo To Start XP Application Loader press A
echo.
echo To Start 2k Application Loader press B
echo.
echo To run but not install tools press C
echo.
echo To just exit this program press X
echo.
echo.
SET Choice=
SET /P Choice= TYPE THE LETTER AND PRESS ENTER: -^>
IF NOT '%Choice%'=='' SET Choice=%Choice%
:: /I makes the IF comparison case-insensitive
IF /I '%Choice%'=='a' GOTO :go2
IF /I '%Choice%'=='b' GOTO :go
IF /I '%Choice%'=='c' GOTO :tools
IF /I '%Choice%'=='x' GOTO :exit
echo "%Choice%" IS NOT VALID. PLEASE TRY AGAIN
echo.
:tools
cls
color 2f

echo TOOLS
echo ***************************************************************************
echo.
echo Start Everest press A.
echo.
echo Start SIW press B.
echo.
echo Start winfile press C.
echo.
echo Go back to main menu D.
echo.
echo To test sound card E.
echo.
echo Go to Driveragent F.
echo.
echo Majic Jelly Bean G.
echo.
echo Jelly Bean Change key H.
echo.
echo Install sp3 I.
echo.
echo MS Key changer J.
echo.
echo To exit program X.
SET Choice=
SET /P Choice= TYPE THE LETTER AND PRESS ENTER: -^>

IF NOT '%Choice%'=='' SET Choice=%Choice%
:: /I makes the IF comparison case-insensitive
IF /I '%Choice%'=='a' GOTO :everest
IF /I '%Choice%'=='b' GOTO :siw
IF /I '%Choice%'=='c' GOTO :manage
IF /I '%Choice%'=='d' GOTO :menu
IF /I '%Choice%'=='e' GOTO :sound
IF /I '%Choice%'=='f' GOTO :agent
IF /I '%Choice%'=='g' GOTO :bean
IF /I '%Choice%'=='h' GOTO :key
IF /I '%Choice%'=='i' GOTO :sp3
IF /I '%Choice%'=='j' GOTO :mskeys
IF /I '%Choice%'=='x' GOTO :exit
:everest
everest.exe
cls
goto :tools

:siw
siw.exe
cls
goto :tools

:manage
winfile.exe
cls
goto :tools

:menu
cls
goto :menue

:sound


0

Response Number 5
Name: Mechanix2Go
Date: September 15, 2008 at 15:01:59 Pacific
Reply:

[1] no point in clearing a var then setting it on the next line

[2] you can save some clutter by losing the

IF /I '%Choice%'=='a' GOTO :go2

and just goto :!choice!


=====================================
If at first you don't succeed, you're about average.

M2


0

Related Posts

See More



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 Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch File Menu in XP

Batch File: Integers in a Txt File Variable www.computing.net/answers/programming/batch-file-integers-in-a-txt-file-variable/19900.html

Batch File Help Needed www.computing.net/answers/programming/batch-file-help-needed/14258.html

Batch File - Start in a new window www.computing.net/answers/programming/batch-file-start-in-a-new-window/13899.html