VOGONS

Common searches


First post, by barryNY

User metadata
Rank Newbie
Rank
Newbie

How do you pass command line parameters to a DOS program that is started up with a desktop shortcut?

Program works great from the shortcut icon when no parameters are specified to the DOS program. When a parameter is specified with the program, I just get the console.

I'm using Windows 7 (what a piece of garbage) running an older DOS communications program to a device via a USB to serial converter cable. All works great in the program's default mode.

Sorry if this is answered elsewhere, but I searched all documentation, online forum and tried everything I could.

Reply 1 of 5, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

The Readme does state how you do this. Search for command and you will find it in the readme

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 2 of 5, by barryNY

User metadata
Rank Newbie
Rank
Newbie

The readme states how to send command line parameters to DOSBOX or to send a DOS command. I need the parameter sent to the DOS program itself.

dosbox "C:\DOSDIR\DOSPROGRAM.EXE" -exit -conf "C:\DOSDIR\DOSPROGRAM.CONF" -noconsole

This is an example of the shortcut icon Target command line. When I execute as above, it works great. But when I add the parameter "/com=3" to be passed to DOSPROGRAM, it aborts and just brings up the DOSBOX console.

dosbox "C:\DOSDIR\DOSPROGRAM.EXE /com=3" -exit -conf "C:\DOSDIR\DOSPROGRAM.CONF" -noconsole

I've tried the -c command parameter, and many combinations and arrangements.

Thank you

Reply 3 of 5, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

How did you try the -c command?
And if that fails why don't you use the autoexec section of the conf when you already pass that along (instead of executing the program with dosbox)?
And most importantly, does the program work inside dosbox with the /com3 command?

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 4 of 5, by barryNY

User metadata
Rank Newbie
Rank
Newbie

The AUTOEXEC section worked. I didn't know that you could use that section to run the final program. The order of execution between AUTOEXEC and the command line parameters was confusing.

My commands in the Autoexec section are:
MOUNT C "C:\DOSPROGRAM"
C:
DOSPROGRAM /COM=4
EXIT

I found that the -noconsole parameter had to be left on the command line. I couldn't get it to work from within the conf file.

Otherwise, I'm 100% up and running. Thanks for your help!

Reply 5 of 5, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

you're welcome. The -noconsole switch is needed for the command line because it needs to be set right away, when Dosbox reads the conf file it is already too late 😀

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper