|| Tips Index || DOS : Navigation | Memory | Hard Disk Configuration | Auto Execute | Batch | Misc
Here is a sample menu program to help you see how to use batch file commands. You can cut'n paste these to use for practice. Save them with the names given, then at a dos prompt, type mymenu to bring up your menu batch file.
Sample Menu Batch File
Filename: 'mymenu.bat'
-------- Start cut to paste here --------
@echo off
:top
cls
Echo.
Echo My Main Menu
Echo ============
Echo DOS (P)rompt
Echo (W)indows
Echo DOS (S)hell
Echo.
Choice /c:pws /t:p,10 Which Environment
If errorlevel 3 goto shlrun
If errorlevel 2 goto winrun
If errorlevel 1 goto dosrun
:shlrun
call dosshell.bat
pause
goto top
:winrun
call windows.bat
pause
goto top
:dosrun
prompt Type 'mymenu' for Main Menu$_$p$g
--------- End cut to paste here --------
|
Filename: 'windows.bat'
------- Start cut to paste here --------
@echo off
cd\windows
win
--------- End cut to paste here --------
|
By also creating a windows.bat file you can return to your menu when you close Windows (exist to a DOS prompt in Windows 95).
If you do not have the dosshell.bat or windows.bat files, the program will simply report a bad command and then continue. You can replace these names with the start commands for your own programs (don't forget to edit the menu text and choice letters).
This file modifies the prompt when it exits to DOS. To restore your original prompt, go to a DOS prompt and type prompt $p$g.
If you create a menu you want to see every time your system starts, edit the autoexec.bat file. Add the batch file name on a line just above the line with win.com, then save it, and restart your computer.
|