VOGONS

Common searches


First post, by rfnagel

User metadata
Rank Oldbie
Rank
Oldbie

I have an extremely complex batch file that I use to run Command & Conquer with. The batch file is a frontend menu of sorts that does most everything that I wish to do in/with C&C.

I was wondering if there was some way to do this, but have a hunch probably not. Two of the menu options in my batch file run execute the folowing labels:

:PDFMANUAL
CLS
@ECHO Press ALT+TAB after viewing the Command and Conquer PDF manual to return to the
@ECHO Command and Conquer Manual, Maps, Strategy Guides, and Walkthroughs menu.
@ECHO.
@ECHO Press any key to continue...
PAUSE>NUL
RUNDLL32 URL.DLL,FileProtocolHandler DOCS\MANUAL\MAIN.PDF
GOTO WALKTHROUGHS

:PLAYMUSIC
CLS
@ECHO Battle control terminated. Press any key to exit and play the Command and
@ECHO Conquer music...
EVA-BCT
PAUSE>NUL
RUNDLL32 URL.DLL,FileProtocolHandler "MEDIA\MUSIC\Command and Conquer.m3u"
GOTO END

Under Windows 98 they work fine (of course), but since you can't execute something that is not located on DOSBox's mounted drive, as well as DOSBox not being able to execute a Win16/Win32 proggie, that wouldn't work.

So, my question: Is there a way (or a DOSBox command) to execute a Windows (or other external) program when DOSBox is shutdown? Both of the above could be modified to shutdown DOSBox, and then execute the RUNDLL32 commands.

Like I said, I'm pretty sure there is no way to do this, but just was wondering if I was missing something (or there was some hidden command of DOSBox that coould run something upon exiting).

(off on a tangent) Hehe, I suppose that I could always use MPXPlay and the old DOS version of the Adobe Reader <grin>.

(edit) for the extremely brave <grin>, attached is my 67KB batch file.

Attachments

Rich ¥Weeds¥ Nagel
http://www.richnagel.net

Reply 1 of 10, by frobme

User metadata
Rank Member
Rank
Member

So, my question: Is there a way (or a DOSBox command) to execute a Windows (or other external) program when DOSBox is shutdown? Both of the above could be modified to shutdown DOSBox, and then execute the RUNDLL32 commands.

You can make a batch file kill a process, via either TASKKILL (built into XP and above) or various utilities - the one I've seen used a lot is pskill from sysinternals.

-Frob

Reply 3 of 10, by rfnagel

User metadata
Rank Oldbie
Rank
Oldbie

I'm a bit confused. How would Taskkill be of help in a batch file running within a DOSBox mounted drive? In other words, the batch file commands above that load a PDF into Adobe (as well as start the Windows Media Player) are contained within the actual batch file that is running under DOSBox.

Rich ¥Weeds¥ Nagel
http://www.richnagel.net

Reply 4 of 10, by frobme

User metadata
Rank Member
Rank
Member

I'm a bit confused. How would Taskkill be of help in a batch file running within a DOSBox mounted drive? In other words, the batch file commands above that load a PDF into Adobe (as well as start the Windows Media Player) are contained within the actual batch file that is running under DOSBox.

I guess I didn't parse your original question properly. I saw "rundll32" and figured that had to be an actual Windows batch file, since Dosbox doesn't shell out or have a built-in for rundll32. Now I see that this must be your old Win98 batch file or something, and you want it to run in Dosbox.

No, Dosbox doesn't currently do what you want. You could hack in some sort of "DOS command" for the Dosbox shell that stored a string or struct, and then call a CreateProcess on the data as Dosbox is shutting down (applicable source is in src/shell)

Reply 5 of 10, by robertmo

User metadata
Rank l33t++
Rank
l33t++

you can make a start.bat file this way:

dosbox.exe
bat4win.bat

inside dosbox you can have a config.bat file that modifies bat4win.bat so that you can decide inside dosbox what will be run (if anything) after you quit dosbox.

Reply 6 of 10, by gidierre

User metadata
Rank Member
Rank
Member
robertmo wrote:

you can make a start.bat file this way:
dosbox.exe
bat4win.bat

minor point maybe
but shouldn't you CALL explicitly the inner, nested .bat from the outer one
I mean:

dosbox.exe
call bat4win.bat

We often forgive those who bore us, but we cannot forgive those whom we bore. (La Rochefoucauld)

Reply 8 of 10, by gidierre

User metadata
Rank Member
Rank
Member

I thought that inner call *.bat would be needed for the called batch to return execution to the caller when it's done.
I see what you mean, though.

We often forgive those who bore us, but we cannot forgive those whom we bore. (La Rochefoucauld)

Reply 10 of 10, by rfnagel

User metadata
Rank Oldbie
Rank
Oldbie

This works perfectly! I can use DOSBox to run my CONQUER.BAT batch file menu, and then if one of the two RUNDLL32 command lines is selected, have DOSBox shutdown and run it 😀 As an example, the "Play Music" selection:

These are the lines in my DOSBox.conf configuration file:

"[autoexec]" section of DOSBox.conf:

[autoexec]
# Lines in this section will be run at startup.
MOUNT C C:\GAMES
MOUNT D D:\ -T cdrom
C:
CD\CONQUER
CALL CONQUER.BAT
EXIT

I start DOSBox using this batch file (STARTHIS.BAT):

Contents of STARTHIS.BAT:

@ECHO OFF
C:\DOSBox\DOSBox.exe -conf C:\GAMES\CONQUER\DOSBox.conf
DOTHIS.BAT

In my CONQUER.BAT batch file menu, I have these lines (the "QUIT" label is the normal clean exit from the CONQUER.BAT):

The required lines in CONQUER.BAT:

:PLAYMUSIC
CLS
@ECHO Battle control terminated. Press any key to exit and play the Command and
@ECHO Conquer music...
PAUSE>NUL
@ECHO RUNDLL32 URL.DLL,FileProtocolHandler "MEDIA\MUSIC\Command and Conquer.m3u">DOTHIS.BAT
GOTO ENDRUNDLL32

:QUIT
CLS
@ECHO Battle control terminated. Press any key to exit...
PAUSE>NUL
GOTO ENDCLEAN

:ENDCLEAN
@ECHO>DOTHIS.BAT

:ENDRUNDLL32

...which either blanks out the "DOTHIS.BAT" batch file, or adds the following to it:

Contents of DOTHIS.BAT:

RUNDLL32 URL.DLL,FileProtocolHandler "MEDIA\MUSIC\Command and Conquer.m3u"

Rich ¥Weeds¥ Nagel
http://www.richnagel.net