Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
i'll try and explain my problem:
i've created a nice menu in DOS using batch files. there is only one problem. when i want to exit my menu there's a problem.on boot i call the autoexec.bat (main menu) from here you can make choises. if you choose an advanced option you will be promted if you want to continue (**), if you choose "no" you will return to the main menu (i do this by calling the autoexec again). if you then choose exit in the main menu the following happends:
the procedure (**) if you choose continue will start.
i think my problem is that i have several batchfiles running at the same time, so when i close one of them the other one continues. but the thing is that i used the command: "exit" after every option. or should i have used another command to close the current batchfile??hope i was able to explain my problem
plz help meAn enemy is not to be underestimated.

"on boot i call the autoexec.bat"
I don't know of any way to NOT run autoexec.bat at boot.
It would help to say what version of DOS you are using.
Also helpful to post your batch.
Use Dr Nick's wonderful CODEPOST utility to get your batch in shape so that it displays properly.
http://students.cs.byu.edu/~drnick/entityrecode.html
M2

ok, i'll try that,
DOS v6.0... here's an example of what i use:
______________________________
option 1
option 2Cmd\choice /c12]/N
if errorlevel 2 goto :ToMain
if errorlevel 1 goto :CrtFac:ToMain
echo Back to the main menu
CALL autoexec.bat
exit:CrtFac
echo Create Factory Back-Up
CALL ghost\ghost.exe -clone,mode=pdump,src=1:1,dst=C:\Images\Factory.gho -Z9 -sure -cns
goto :Quit:Quit
echo Quit
CALL Quit.bat
exit
______________________________the autoexec will be run, i choose the option to create a factory image, i decide i dont want to create one. i go back to the main menu and i want to exit the entire process.
while exiting the :CrtFac will begin.An enemy is not to be underestimated.

Hi,
Well if that's actual code, I'm pretty much lost.
Are these comments:
option 1
option 2If not, what do they do?
CMD is neither an internal DOS command nor a standard part of a DOS installation. So what is it?
If you want to ECHO a msg, you first turn echo off.
Many batch writers always put this as a first line.
@echo off
I usually use:
@echo off > quit.bat
which gives me a 'hasty exit'.
I would avoid at all costs CALLing or doing anything with autoexec.bat; it's a recipe for trouble.
You do not need to CALL an EXE. CALL is to run another batch and return control to the CALLing batch.
In this bit:
::**
goto :Quit:Quit
echo Quit
CALL Quit.bat
::**
the goto doesn't seem very useful because where it's 'going' is the next line down.M2

ok my bad, should have explained better, lemme work those things out and i'll try to understand what you said:
_________________________________
@echo off
CLSecho.
echo.
echo 1 Create a factory image
echo 2 Resturn to main menuchoice /c12]/N
if errorlevel 2 goto :ToMain
if errorlevel 1 goto :CrtFac:ToMain
echo Back to the main menu
CALL MainMenu.bat
exit:CrtFac
echo Create Factory Back-Up
ghost\ghost.exe -clone,mode=pdump,src=1:1,dst=C:\Images\Factory.gho -Z9 -sure -cns
CALL Quit.batAn enemy is not to be underestimated.

tnx :) it looks a lot better now but i still have the following problem:
mainmenu.bat is run --> advanced option is chosen --> return to mainmenu.bat --> exit the menu --> create factory image starts.
(the :CrtFac option)do you know how to end the batch file before the :CrtFac thing starts?
An enemy is not to be underestimated.

Hi,
If this:
ghost\ghost.exe -clone,mode=pdump,src=1:1,dst=C:\Images\Factory.gho -Z9 -sure -cns
is all one line. [I guess it is]
And if your quit.bat 'does nothing' like mine. Then there's probably no good reason to return to the batch.
In that case eliminate the line:
CALL quit.bat
Then your last line, starting with:
ghost\ghost.exe
is the last thing the batch does.
It's done.
HTH
M2

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

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