Computing.Net > Forums > Programming > Bach menu help

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.

Bach menu help

Reply to Message Icon

Name: slapfish
Date: March 20, 2007 at 08:21:26 Pacific
OS: Win XP SP2
CPU/Ram: CORE 2 T7200 / 1GB
Product: ACER
Comment:

Hello,

I want to create a menu with 4 choices.
I found on previous post the way to do so,
but I want to exit the batch file if 5seconds passed without pressing a key. Is it possible?

thanks a lot




Sponsored Link
Ads by Google

Response Number 1
Name: tonysathre
Date: March 20, 2007 at 09:59:28 Pacific
Reply:

There is no way to have a menu and a timeout. You can however have a timeout using ping, but it will not work with a menu. The following code will add a menu to your script with 4 options. Be sure to add your code under each label.

::==menu.bat
@echo off
for %%i in (1 2 3 4) do echo Choice %%i
echo Enter Choice:
set /p choice=
for %%a in (1 2 3 4) do (
if "%choice%"=="%%a" goto choice%%a
)

:choice1
::your code goes here

:choice2
::your code goes here

:choice3
::your code goes here

:choice4
::your code goes here

"Computer security." — Oxymoron


0

Response Number 2
Name: Mechanix2Go
Date: March 21, 2007 at 02:22:51 Pacific
Reply:

@echo off
setLocal EnableDelayedExpansion

echo choose a menu item : 1 2 3 4
choice /c12345 /t5,5 /n
goto :%errorlevel%
:1
echo choice 1 & goto :eof
:2
echo choice 2 & goto :eof
:3
echo choice 3 & goto :eof
:4
echo choice 4 & goto :eof
:5



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

M2



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







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: Bach menu help

Vb menu help www.computing.net/answers/programming/vb-menu-help/9505.html

Start Menu Help!!!!!!May be easy www.computing.net/answers/programming/start-menu-helpmay-be-easy/858.html

Help with java gui www.computing.net/answers/programming/help-with-java-gui/8572.html