VOGONS


Closing DOSBox.

Topic actions

First post, by d347hm4n

User metadata
Rank Newbie
Rank
Newbie

Hello,

I'm using DOSBox to run Legacy 16-bit code from 91 in Softgrid (App-V). It works very well and the program runs. But when I follow the menu choice in the program to exit, I am left with the DOSBox window open. If I click on the X everything closes correctly.

I am running DOSBox with a batchfile. I cd to DOSBox's directory and call the DOSBox.exe with the full path to the executable that I want to run.

Essentially I am asking is there a switch for me to close down DOSBox, or is there a way I can detect the program that is running inside of DOSBox in the taskmanager or can DOSBox tell me what is running inside of it.

I hope that I have made myself clear.

Reply 1 of 18, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

it's explained in the documentation of dosbox.

Water flows down the stream
How to ask questions the smart way!

Reply 2 of 18, by d347hm4n

User metadata
Rank Newbie
Rank
Newbie

Ok thanks, but for others, you just need to pass in the -exit flag after the full path for the program.

Thanks, took me like 30 minutes to find that, could have saved me some time but nvm....

Reply 3 of 18, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

I wrote the documentation in the hope that I didn't need to answer questions about things described there.

Water flows down the stream
How to ask questions the smart way!

Reply 4 of 18, by DaveDoesIT

User metadata
Rank Newbie
Rank
Newbie

I have to side with QBix on that one. RTFM first.

Another option since you are running from a Batch file is to add Exit as the last line of your Batch file.

Dave

Reply 5 of 18, by gpicht

User metadata
Rank Newbie
Rank
Newbie

Hello,

I'm a newbie here and have only first experiences with DOSBox and Vista - my favoured OS is still W2K.

The -exit parameter (or the exit in a started batchfile) is working fine in general. But I have one application, where I couldn't get it running right now. It is an very old DOS program system fur surveying calculations, which I have still in the production process.

The program system is started by execution of a batchfile and the calculations are choosen menuebased. Depending on the userinput some action starts, no chance to analyse the workflow between DOS-programs and automatically created batchfiles for those menues. Ending this program leaves me with a open DOSBox - even with -exit-parameter.

At this time this post is only a report of this effect, so please don't answer: 'read your manual'.

I still do so 😊 and try to analyse and find a solution.

Reply 6 of 18, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

what is the commandline you use ?

Water flows down the stream
How to ask questions the smart way!

Reply 7 of 18, by gpicht

User metadata
Rank Newbie
Rank
Newbie

The desktop icon starts with:
"C:\Program Files\DOSBox-0.72\dosbox.exe" -conf "C:\Program Files\DOSBox-0.72\dcs.conf" -exit

and the dcs.conf executes:

keyb gr
mount c c:\*****
c:
gusdcs
exit

where gusdcs is the batch-file

c:
cd \geodcs
gn

and gn is the next batch file, this starts menue and (sub)progs

You see, in this actual version I have '-exit' in startstring, 'exit' in DOSBox config-file and in my first batchfile. And the window remains open.

Edit: Sorry, in the first batchfile is actually no 'exit'.

Reply 9 of 18, by MiniMax

User metadata
Rank Moderator
Rank
Moderator
gpicht wrote:

The desktop icon starts with:
"C:\Program Files\DOSBox-0.72\dosbox.exe" -conf "C:\Program Files\DOSBox-0.72\dcs.conf" -exit

Remove the -exit option. It only works when you launch DOSBox with a file.

gpicht wrote:
and the dcs.conf executes: […]
Show full quote

and the dcs.conf executes:

keyb gr
mount c c:\*****
c:
gusdcs
exit

Add a call before gusdcs:

keyb gr mount c c:\***** c: call gusdcs […]
Show full quote

keyb gr
mount c c:\*****
c:
call gusdcs

Or you can remove the exit command and the call to gusdcs from dcs.conf and launch DOSBox like this:

"C:\Program Files\DOSBox-0.72\dosbox.exe" -conf "C:\Program Files\DOSBox-0.72\dcs.conf" "C:\*****\gusdcs.bat" -exit

Then your dcs.conf should only contain:

keyb GR
mount C "C:\*****"
C:

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 10 of 18, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

If you're going to go with putting an "exit" in the top level batch file, you need to put "call" in front of all batch file "subroutines", so in gusdcs you need to change it to "call gn", and so forth, or it won't "return" back up the chain.

Reply 11 of 18, by gpicht

User metadata
Rank Newbie
Rank
Newbie

thanks a lot, I've never expected so worthful tips in such short time. I will test it und tell you the result - tomorrow after sunrise 😉

Reply 12 of 18, by gpicht

User metadata
Rank Newbie
Rank
Newbie

My problem is solved. As you said, a simple 'call gusdcs' followed by 'exit' in the conf-file closes the Box at the end. No need for -exit in the runstring and no need for modifiing the deeper (in my case unaccesible) batch-files.

Thanks again 😀

Reply 13 of 18, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

You stated that "gn" was another batch file; apparently it is a program, because you would have to call it if it were a batch file.

Reply 14 of 18, by MiniMax

User metadata
Rank Moderator
Rank
Moderator
ripsaw8080 wrote:

because you would have to call it if it were a batch file.

No.

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 15 of 18, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Yes.

You would have to call it in order to return back to the exit in the top level batch file. Happy now?

Reply 16 of 18, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

Did you try it?

bat1.bat

echo bat1
call bat2

bat2.bat

echo bat2
bat3

bat3.bat

echo bat3

db.conf

[autoexec]
mount C "."
C:
call bat1
exit

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 17 of 18, by ripsaw8080

User metadata
Rank DOSBox Author
Rank
DOSBox Author

You're right, it does work that way in the specific case where the last command in a batch file transfers processing to another batch file. However, if you ever want to continue processing additional commands in any given batch file after running a sub-batch, you must add the CALL.

Reply 18 of 18, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

Absolutely 😀

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32