Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
when i shut my windows and start the computer in dos
i want to see clean screen with a menu that i wrote
for now all i know is that the menu coul'd be in a batch file

Yeah, you could create a batch file (.bat) with a menu, and make dosstart.bat to execute it. That dosstart.bat, which is under the windows folder, gets executed when you select the option "Restart the computer in MS-DOS mode" on the Start Menu from Windows.
From your post, I couldn't understand if you already have that menu written or not. There are some examples on how to make a menu via batch file on my FAQ:
After making that batch file, just add a line refeering to it on the end of dosstart.bat. For instance:
call c:\MyBatchFiles\MyMenu.bat
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br_____________________________________________________

thank you this exactly what i want.
about the menu:
i just start learning dos programming and i can't understand some part in your great example.i woul'd love to know about a site how teach from the beginning programming in dos.

Try these tutorials:
http://gatsby.tafe.tas.edu.au/batch/index.htm
http://life.homepage.dk/batfiles/
If you want an explanation on a specific part of a batch file code, I can give it to you.
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

i want to make more than let say 9 choices and i want to choose options with numbers.
so i need to be able to write two digit numbers.
it's say's that my choice will be read only after ENTER.thanks for the links

You can:
1. Specify letters instead of numbers associated to the options (the simpler solution).
2. Use another way of getting user input, which would be like you described - only finished when user hits enter. That is covered in my FAQ #06 - get user input.
3. Use a combination of CHOICE prompts. Something like this:
@echo off
echo Choose an option:
echo.
echo [01] Option 1
echo [02] Option 2
(...)
echo [20] Option 20
:choice
CHOICE /c:120 /n > nul
for %%? in (1 2) do if errorlevel=%%? set d1=%%?
if errorlevel=3 set d1=0
CHOICE /c:1234567890 /n > nul
for %%? in (1 2 3 4 5 6 7 8 9) do if errorlevel=%%? set d2=%%?
if errorlevel=10 set d2=0
if "%d1%"=="2" if not "%d2%"=="0" goto choice
echo You've chosen option %d1%%d2%The prompt messages ("[1,2]?") won't be displayed, so the interface looks like a single prompt for a 2-digit-number. However, as you can see, that method is not very neat, there are some difficulties associated to it, like the problem avoided by the line before the last line of code - if the user hits 2 on the first prompt and then anything other than 0 on the second prompt, that isn't a valid option and we must get back to the prompting. If more options were avaliable, like 21 22 23, it would take more trouble to make sure the entry is valid.
I recommend using method 1, unless you've got a relevant reason to use method 2 or 3.
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br________________________________________________________________

Use something like this:
@echo off
:menu
cls
echo.
echo Choose:
echo.
echo [1] Doom
echo [2] Heretic
echo.
echo [0] Exit
echo.
choice /c:012
if errorlevel=3 goto heretic
if errorlevel=2 goto doom
goto end
:heretic
c:\games\heretic\heretic.exe
goto menu
:doom
c:\games\doom\doom.exe
goto menu
:endNotice the importance of including an option for exiting the batch file.
-- Leonardo Pignataro - Secret_Doom --
secret_doom@hotmail.com
www.batch.hpg.com.br

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |