Alternative ways to launch a batch file from the command prompt?

Status
Not open for further replies.

Karmashock

Posts: 223   +0
Ok, I've got an extremely old version of DOS that needs to launch a batch file that requires cmd.exe .

For this reason there are two things I can't do. I cannot simply launch the batch file by entering in the path\filename and i can't use "start Path\filename" because start is a relatively new addition to the DOS.


So what I'm looking for is something I can type into an OLD version of dos that will call up the CURRENT CMD command prompt, execute the batch file, and then close.


So far... I'm lost.
 
No, an OLD version of dos had to execute the file in such a way that it would create an instance of CMD which would then launch the batch file. If that version of dos launches it directly then it causes errors. I couldn't figure out how to dos to do it... I even tried commands like
Code:
Echo CommandIWishedToRun | CMD.EXE

That got me no where because while it did run CMD and enter in the correct code it launched CMD within the old verison of dos and it crashed due to memory issues.

I was finally able to do it with Autoit.
I used the following code and then complied the autoit script into an exe.
Code:
Run(@COMSPEC &  "/c Start Path\Filename")
Exit
This creates a new instance of CMD independent of the first program and then runs my batch file. This bypasses the problem.

The only weakness in this code appears to be that you can't have spaces in the file name. Putting in additional "" marks causes a syntax error.


This isn't a problem for me but its something to be noted.

I'm also a little disappointed that I couldn't run CMD successfully in the old dos window, do what needed to be done, then terminate it allowing for an uninterrupted fullscreen dos experience.

Not a big deal.
 
No pretty sure he's not talking about Dos shell (in Windows??)

But the real easy option here (other than "call" which I use in my batch files)
Is to update your Dos version, to allow the command "Start"

Also the inverted commas are normally not required if using inside Windows (which I still think he's not doing; probably running from CD or something??)
 
Status
Not open for further replies.
Back