Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
pilottobombadier

Batch files

Recommended Posts

Okay, I want to make a batchfile with options in it so it will load certain things...in other words, a numerical menu type thing. How do I go about that? Please e-mail me if you know at pilottobombadier@yahoo.com

NWC

Share this post


Link to post

Bah! That's easy. There's a few different ways to do it. You can use "choice" or you could do it the easy way. Just write a batch file that displays the options. Then write a separate batch file for each option.

For example.

PlayDoom.bat:

echo Welcome to the wonderful world of Doom!
echo What would you like to do?
echo 1: Play Doom?
echo 2: Play Doom2?
echo 3: Play the wonderful new megawad Alien Vendetta?
echo 4: quit
echo Type the number of the option of your choice, and press the enter key.

You would then write 4 separate batch files named 1 through 4.

1.bat:

cd\doom
doom

2.bat:

cd\doom2
doom2

3.bat:

cd\doom2
doom2 -file av.wad

4.bat:

echo Thank you, have a nice day :)

The advantage of this method is there is no limit to the number of options. It's also much easier to add or remove new options later.

Share this post


Link to post

Oh one thing I forgot. Make sure you place the line:

@echo off

at the top of each batchfile. This will stop the lines from being displayed twice.

Share this post


Link to post
Guest
This topic is now closed to further replies.
Sign in to follow this  
×