Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DOS .BAT menus
#1
Many of the younger in the forum may never have come across the ancient BATCH.COM DOS program for creating a simple menu using a .BAT file. Being a .BAT fill it consumes very little RAM so should run ANY DOS program. Below is an example of a Games menu I am constructing using the brilliant DOSBOX available from http://dosbox.sourceforge.net which I am using to run a number of old DOS programs and games that I thought I would never get to run again on a modern PC with Win. XP etc.

You can pick up the BATCH program from http://sionet.mysite.wanadoo-members.co.uk/PCA.zip along with the nice PCA filemanager that displays ALL files irrespective of how your Windows File settings are cunstomised. Gordon

Code:
REM Batmenu (c) G.Sweet Ver 2
ECHO OFF
:START
CD \
CLS
ECHO .
ECHO                               MENU OF DOS GAMES.
ECHO .
ECHO     Make sure the Caps Lock is OFF then press :-
ECHO .
ECHO  a = Asteroid   b = Blast  c+ = Casino.
ECHO .
ECHO                          d = Abort to DOS
BATCH/B
BATCH/A      ?
ECHO .
REM       Errorlevel must be greater than last option for re-START
IF ERRORLEVEL 122 GOTO END
IF ERRORLEVEL 99 GOTO c
IF ERRORLEVEL 98 GOTO b
IF ERRORLEVEL 97 GOTO a
REM      Errorlevel to trap keys less than 97 = a
IF ERRORLEVEL 32 GOTO START

:a
CD \486GAMES\ASTEROID
ASTEROID
GOTO START

:b
CD \486GAMES\BLASTER
BLAST
GOTO START

:c
CD \486GAMES\CASINO
CASINO
GOTO START

:END
CLS
ECHO ON
Reply
#2
He he he... That reminds me of how proud I was when I learned how to make a batch from scratch. Tongue

Man, I made this humungous menu thing for my first QB games... It was just ridiculous. :lol:
Reply
#3
But why mess with that? Just write a QBasic program

Assumes you are already in 486GAMES, i.e. your original BAT is

Code:
@echo off
cd \486GAMES
qbasic /run Menu

Code:
CLS
LOCATE 5, 30: PRINT "MENU OF DOS GAMES"
LOCATE 8, 35: PRINT "a = Asteroid"
LOCATE , 35: PRINT "b = Blast"
LOCATE , 35: PRINT "c = Casino"
LOCATE , 35: PRINT "d = Abort to DOS"
PRINT
LOCATE , 32, 1: PRINT "Choice: ";
DO
  DO: k$ = INKEY$: LOOP WHILE k$ = "": PRINT k$: PRINT : PRINT
  SELECT CASE UCASE$(k$)
  CASE "A": Shellx "Asteroid"
  CASE "B": Shellx "Blast"
  CASE "C": Shellx "Casino"
  CASE "D": CLS : SYSTEM
  CASE ELSE: PRINT "No such choice": CALL Refresh
  END SELECT
LOOP

SUB Refresh
PRINT "Press spacebar to refresh"
DO: k$ = INKEY$: LOOP WHILE k$ <> " "
RUN
END SUB

SUB Shellx (Game$)
'shell Game$
PRINT "Started " + Game$
CALL Refresh
END SUB
Reply
#4
... because other people can run your .bat files without loading Qbasic. Of course, you could compile to an EXE with QB, but really, a .bat is better in that it's editable by the end-user - that could be a downside, though, depending on how you look at it.
Reply
#5
The reason why I would use a BAT file instead of ANY program as a menu, is sometimes Games/Programs fail to run because of lack of RAM taken up by the menu. Please try out you idea on various DOS programs or games yourself.

This is why a QB menu I produced many moons ago also runs from a BAT file, by altering the BAT file to run the program. I copied the idea from a DOS menu program called Menumaster. Anyone is welcome to my menu if they buzz men. Unfortunately for some reason my dear old DOS menu now fails to work properly under the excellent DOSBOX, because it will not allow the DOS menu to alter the BAT menu from which it runs.

Gordon
Reply
#6
I used to use a little com i wrote in DEBUG called getkey.com. It was basically a copy of the famous getkey program...but it was minute, and it returned the errorlevel.

I once wrote a game in batch...I'll look for it.
·~¹'°¨°'¹i|¡~æthérFòx~¡|i¹'°¨°'¹~·-
avinash.vora - http://www.avinashv.net
Reply
#7
Quote:I once wrote a game in batch...I'll look for it.

I started one, but then I discovered DirectQB and all was lost. :lol:
Reply
#8
I have discovered there appears to be a limit to the number of options this BATCH.COM technique can cope of around 25. But you can use CALL MENU2 as an option to divert to another menu.

I had a look around my collection of ancient DOS progs. to see if I had a GETKEY without success of course. But I did find a couple more BAT menu programs, I have now put up in below. Just run thenm under DOS to see their details.

http://sionet.mysite.wanadoo-members.co.uk/PCA.zip

Gordon
Reply
#9
Hi, DrV
Quote:because other people can run your .bat files without loading Qbasic
I assume you mean that people who do not have QBasic.EXE on their machine can run. That is no benefit if, instead, they must load ask.com or whatever software you are using to query the user. In either case they have to modify their system. As a QBasic lover, I would recommend they load QBasic.



Hi, GordonSweet,
Quote:The reason why I would use a BAT file instead of ANY program as a menu, is sometimes Games/Programs fail to run because of lack of RAM taken up by the menu. Please try out you idea on various DOS programs or games yourself.

Good point. Now, if that is the only reason you are avoiding a QBasic program to do this, try the one below. It works with no memory usage by the menu during game play.

Mac
Code:
' This program must be in your Games directory
' It must be named Menu.BAS
' There must also be Menu.BAT as follows:
'    @echo off
'    qbasic /run Menu
'    if exist MenuGo.bat MenuGo.bat

CONST Xfer = "MenuGo.bat"
ON ERROR GOTO Ignore: KILL Xfer: ON ERROR GOTO 0
CLS
LOCATE 5, 30: PRINT "MENU OF DOS GAMES"
LOCATE 8, 35: PRINT "a = Asteroid"
LOCATE , 35: PRINT "b = Blast"
LOCATE , 35: PRINT "c = Casino"
LOCATE , 35: PRINT "d = Abort to DOS"
PRINT
LOCATE , 32, 1: PRINT "Choice: ";
DO
  DO: k$ = INKEY$: LOOP WHILE k$ = "": PRINT k$: PRINT : PRINT
  SELECT CASE UCASE$(k$)
  CASE "A": PGM$ = "Asteroid"
  CASE "B": PGM$ = "Blast"
  CASE "C": PGM$ = "Casino"
  CASE "D": CLS : SYSTEM
  CASE ELSE:
    PRINT "No such option. Press spacebar to acknowledge"
    DO: k$ = INKEY$: LOOP WHILE k$ <> " "
  END SELECT
LOOP WHILE PGM$ = ""
OPEN Xfer FOR OUTPUT AS #1
PRINT #1, PGM$
PRINT #1, "Menu"
CLOSE
SYSTEM
Ignore: RESUME NEXT
Reply
#10
batchs... don't remind me about them. some script kiddy figured it'd be funny to make a batch and send it to my brother... I spent all night trying to clean it up. :lol:
Jumping Jahoolipers!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)