WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

DOS

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Prevent New DOS Box from Opening Each Command

Keywords: 	 prevent new DOS box

Question:

Whenever I run a Dos Command using the Run("","") function it starts up a new Dos box. I would like to run several commands in the same Dos box but evertime the first command finishes the Dos box closes.

Answer:

Place the multiple commands in a batch file.

You might also try adding command /c or cmd /c to your command line, as you would in the DOS environment, to start another command interpreter session. This should return control to the parent session of the command interpreter, and if the DOS window stays open, you should be able to pass further commands to it...

Maybe don't add the /c to the parameter string?

Question (cont'd):

The reason I can't put the commands into a single batch file is becuase I need to carry out several Winbatch functions before the next Dos Command is run. Ideally I need a way to receive Dos Command Return Codes in Winbatch. It seems that the Run command only returns a True or False as to whether or not it found the target program. What I need to do is get Winbatch to process several different functions depending on the return code of a Dos Command.

Answer:

You might have to run your DOS processes from batch files and have commands of the form:
	if exist status.ini del c:\status.ini
	call (your executable)
	If errorlevel = blah 
	echo SUCCESS=1 > c:\status.INI
and so on

(check my syntax for DOS IF command as it's been a while...)

Then you can loop until status.ini appears, and read the contents for a result.

If you RunWait the DOS BAT file, then you can use

	code=IntControl(64,0,0,0,0) 
to get the return code.
Article ID:   W12896
Filename:   Prevent New DOS Box from Opening Each Command.txt
File Created: 1999:04:15:16:50:22
Last Updated: 1999:04:15:16:50:22