VOGONS

Common searches


First post, by 5150dole

User metadata
Rank Newbie
Rank
Newbie

The DOSBox man page explains that one should be able to run a DOS command/program directly from a Unix-like bash (etc.) shell:

dosbox [file]

Accordingly, I can run this:

dosbox EXPAND.EXE

However, I want to use EXPAND.EXE non-interactively and I want to script this from bash. I would like to run the following:

dosbox EXPAND.EXE DELOLDOS.EX_ DELOLDOS.EXE

However, this does not work as expected. Perhaps differences between Unix/DOS whitespace handling and globbing are a complicating factor. Either way, I want to run the EXPAND.EXE as before and give it the "DELOLDOS.EX_ DELOLDOS.EXE" input and output file parameters.

How do I do that?

(NB: Just EXPAND does not work, it's necessary to specify the full filename for [file], with extension. Perhaps DOSBox could be improved so as to tolerate the omission of executable file extensions?)

I have also tried

dosbox -c EXPAND.EXE DELOLDOS.EX_ DELOLDOS.EXE

but that's failing even worse, because it tries to run the EXPAND.EXE command before mounting the partition the EXPAND.EXE is on, and it also doesn't handle the parameters correctly.

It's not really clear from the man page what I should rather do.

Reply 1 of 9, by bregolin

User metadata
Rank Member
Rank
Member

I'd recommend creating a DOS batch file to run under DOSBOX, and then you can trigger it via bash. Don't think you can pass parameters between the OS and DOSBOX, but if you use fixed file names and update them via your bash script, you'll be fine

IBM Aptiva 2162 - P55 166 MMX, 32MB, CS4237B + Wavetable, ATI Mach64 2MB / Win98SE
Custom PIII 750, 64MB, SB AWE64, Voodoo 3 3000 AGP / Win98SE
Sony Vaio z505 SuperSlim - PIII 550, 192MB, YMF744, NeoMagic 256AV+ / Win98SE

Reply 2 of 9, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

Is there not a decompression utility for Linux that can decompress these files? Anyone tried 7zip? Not able to test at this time.

How To Ask Questions The Smart Way
Make your games work offline

Reply 4 of 9, by 5150dole

User metadata
Rank Newbie
Rank
Newbie

@bregolin: I did consider making a batch file, and in fairness,

dosbox TEST.BAT

works, so thanks anyway for that hint.
I really, really would like to write a Unix-like shell script though, and even having a shell script write a .BAT file is only an ugly, second-best option.

@DosFreak: As far as I know there is not currently a decompression utility for Linux that can decompress the kind of COMPRESS/EXPAND files used in MS-DOS 6.22 in particular, which is what I was trying to do. There is an mscompress/msexpand utility, but it specifically is not compatible with the MS-DOS 6.22 variant, which seems to be a long-standing issue. For what it's worth, I have emailed the author. Part of the problem there also seems to be that msexpand won't take a parameter specifying the output filename, while Microsoft's EXPAND.EXE does do that, and MS-DOS 6.22's COMPRESS/EXPAND apparently won't store the full original filename in the compressed *.??_ file. Its SETUP seems to source those from the PACKING.LST. (I think. I could be wrong on that latter detail.)

Reply 5 of 9, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

What about the Windows (or ReactOS) expand can it run in Wine and also decompress the MS-DOS files?
I've used the Windows 10 one to decompress 9x and NT4. Never tried it with MS-DOS.

How To Ask Questions The Smart Way
Make your games work offline

Reply 6 of 9, by 5150dole

User metadata
Rank Newbie
Rank
Newbie
ripsaw8080 wrote on 2021-01-25, 15:38:

Spaces are treated as delimiters, so I'd try quotes to get around that, e.g.: dosbox.exe -c "expand.exe program.ex_ program.exe"

I'm not sure we're not talking at cross-purposes. I'm trying to pass DOSBox a command with parameters from a Unix-like shell. Your dosbox.exe would seem to suggest something Windows-ish, and I'm not sure your reply would be equally applicable to Windows-like and Unix-like OSes, since whitespace handling and file globbing tend to be different between the two.

Like I mentioned earlier, the first problem with

dosbox -c EXPAND.EXE DELOLDOS.EX_ DELOLDOS.EXE

is that it tries to run the EXPAND.EXE command before mounting the partition/directory the EXPAND.EXE is on. Regarding the whitespace problems, dosbox -c [command] never gets to the point where that would come into play, it can only run what's already on Z: at that point, because dosbox -c runs "too early". I have no idea what purpose it serves to have -c commands run before [file] mounts, or to have [file] not accept parameters. Maybe that's a bug? Observe:

$ cat TEST.BAT
@ECHO OFF
ECHO The quick brown fox jumps over the lazy gander.
$ cat TEST2.BAT
@ECHO OFF
ECHO A man, a plan, a canal, panama.
$ dosbox -c TEST.BAT TEST2.BAT

DJ9i8B9.png

You are right with the quotation marks insofar as I can get this to work:

$ dosbox -c "echo hello, world" TEST2.BAT

But that's pretty much secondary, echo being a built-in command. I'm trying to run something with parameters that's not already built into DOSBox. -c command seems to be unable to do that.

Last edited by 5150dole on 2021-01-25, 21:16. Edited 3 times in total.

Reply 7 of 9, by 5150dole

User metadata
Rank Newbie
Rank
Newbie
DosFreak wrote on 2021-01-25, 19:15:

What about the Windows (or ReactOS) expand can it run in Wine and also decompress the MS-DOS files?
I've used the Windows 10 one to decompress 9x and NT4. Never tried it with MS-DOS.

I don't know where I would get a copy of those other versions of expand. If ReactOS has its own version, perhaps that's freely available? (If you have a link there, post it.)
However, I'm not really lacking a version of expand as such. MS-DOS 6.22's EXPAND.EXE works here, in principle, only I'd rather bash-script it. Changing the .EXE wouldn't change that, though perhaps running that .EXE within ReactOS might, but I have no idea if ReactOS is externally scriptable either. Also, at the point where we're solving the issue with ReactOS, this would become off-topic here, since this is a general question about DOSBox usability, posted in a DOSBox forum.

Reply 8 of 9, by DosFreak

User metadata
Rank l33t++
Rank
l33t++

Well you are missing the ability to decompress files from the host os and are attempting to run an exe from ms-dos that is not included with dosbox to script a solution from Linux to decompress files within dosbox (an emulator). It would seem easier to me to try to remove as many layers as possible. If there is no ability to decompress the files from Linux then grabbing expand from the freely available ReactOS iso or from windows itself (if you acquired expand from dos I don't see why you couldn't from windows) and then trying them from wine (since they would be PE) would be preferable but keep on keeping on not seeing the forest for the trees.

Last edited by DosFreak on 2021-01-25, 22:04. Edited 1 time in total.

How To Ask Questions The Smart Way
Make your games work offline

Reply 9 of 9, by Jorpho

User metadata
Rank l33t++
Rank
l33t++
5150dole wrote on 2021-01-25, 20:54:

Like I mentioned earlier, the first problem with

dosbox -c EXPAND.EXE DELOLDOS.EX_ DELOLDOS.EXE

is that it tries to run the EXPAND.EXE command before mounting the partition/directory the EXPAND.EXE is on.

As per the DOSBox readme, you can chain multiple -c switches, as in

dosbox -c "mount c ." -c "c:" -c "EXPAND.EXE DELOLDOS.EX_ DELOLDOS.EXE"

or even

dosbox -c "mount d /home/blah/" -c "mount c ." -c "c:" -c "d:\EXPAND.EXE DELOLDOS.EX_ DELOLDOS.EXE"