Any DOS gurus here?

mal

Established Member
Can anyone help me out with writing a menu batch file?

It would end up looking something like this:

Code:
Alexander Theatre Lighting PC

1. Remote console

2. Node

3. Offline Editor

4. Exit to DOS

This batch file would be run by the autoexec.bat and would in turn run either remote.bat, node.bat or offline.bat.

Unfortunately I just can't get my head around the required syntax or format. :/

Any help would be greatly appreciated. :)
 
I guess something like this :

@echo off

:start

cls

echo My Menu

echo 1.a

echo 2.b

echo 3.c

echo 4.d



choice /c:1234

if errorlevel 4 goto d

if errorlevel 3 goto c

if errorlevel 2 goto b

if errorlevel 1 goto a

:a

cd\

titi.exe

goto exit

:b

cd\

titi.exe

goto exit

:c

cd\

titi.exe

goto exit

:D

cd\

titi.exe

goto exit

:exit

cls
 
Thanks vbt. :thumbs-up:

IIRC (I'm home now) that's pretty much what I had, but it just ran the first option no matter what I chose. I guess I must have missed something.
 
Originally posted by mal@Sat, 2005-08-06 @ 05:44 PM

Thanks vbt. :thumbs-up:

IIRC (I'm home now) that's pretty much what I had, but it just ran the first option no matter what I chose. I guess I must have missed something.

[post=137996]Quoted post[/post]​


put rem before the echo off, maybe you're using win2000 or winxp, the choice function may be no more available.

EDIT : uploaded :)
 

Attachments

  • CHOICE.zip
    2.9 KB · Views: 130
  • CHOICE.zip
    2.9 KB · Views: 137
  • CHOICE.zip
    2.9 KB · Views: 138
  • CHOICE.zip
    2.9 KB · Views: 141
Actually you probably had the error levels reveresed in the choice option. It makes a difference.
 
I've finally had a chance to try it out and it works as I'd hoped.

Thanks again vbt. :cheers
 
Back
Top