HomeForumsWhat's newResources 
 
 
Any DOS gurus here?
mal - Aug 5, 2005
 mal Aug 5, 2005
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.

 vbt Aug 5, 2005
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



cd\

titi.exe

goto exit

:exit

cls

 mal Aug 5, 2005
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.

 vbt Aug 5, 2005

  
	
	
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

 dibz Aug 11, 2005
Actually you probably had the error levels reveresed in the choice option. It makes a difference.

 Scared0o0Rabbit Aug 13, 2005
I always wondered how you did choices in batch files... but was too lazy to look it up lol.

 antime Aug 13, 2005
In cmd.exe, set /p... sets an environment variable from user input.

 mal Aug 14, 2005
I've finally had a chance to try it out and it works as I'd hoped.

Thanks again vbt. :cheers