I think I've figured out what's causing the problem.
* My batch file is called WS6.BAT.
* The ws.exe executable file is in a directory called WS6.
DOSBox is attempting to "run" the directory WS6 instead of the batch file WS6. Since I'm in a Linux environment, I made sure that the executable property of the WS6 directory was cleared for owner, group and others, using chmod, but it makes no difference; DOSBox still attempts to execute directory WS6.
If I rename WS6.BAT as WS9.BAT, it behaves the same way as I would expect it to in a real DOS environment and I can run the batch command WS9 from anywhere in the PATH without having to add ".BAT" to the command line.
DOSBox must first test whether a command string can be matched with one or more file names in the PATH as it parses the PATH value from left to right. (In my example, it should look for "WS6" first in C:\WS6, then in C:\ and finally in C:\BATCH. It must attempt to run partial matches in each path exactly in the following order (See http://support.microsoft.com/kb/35284
In other words, it needs to first look in C:\WS6 for WS6.COM, WS6.EXE and WS6.BAT; then look in C:\ for WS6.COM, WS6.EXE and WS6.BAT; finally, look in C:\BATCH for WS6.COM, WS6.EXE and WS6.BAT.. Any directory matching the name "WS6" in those three places must be ignored and DOSBox should not even attempt
to run it. Once DOSBox has exhausted the search for EXE, COM and BAT possibilities and failed to make a match, it should report "Bad command or file name".
I tried repeating your experiment with a simple directory structure that looks like this:
- Code: Select all
+ - WS8
+ - DOC
and running a batch file in C:\BATCH called "WS8.BAT" that looks like this:
- Code: Select all
It runs fine the first time from C:\, but fails when one attempts to run it a second time from C:\WS8\DOC. See the attached screenshot. Note that DOSBox reports "Illegal command: ws8.", with a trailing period. I don't know if it is saying it is trying to execute an entity called "ws8." or if the period was simply added for style in the screen message. While in C:\WS8\DOC I can reset the PATH value to C:\;C:\BATCH and type "ws8", and it still fails, telling me that it finds the directory called "WS8" in C:\, tries to execute it and gives up.
This is definitely a DOSBox bug that should be brought to the attention of the developers
, though I'm not sure how to do it.