'Is it possible to use output redirections from a cmd file using start?

I want to have a cmd file with something like:

:one
start /wait (blabla1.exe -q -m 1>blabla1.log 2>&1)

:two
start /wait (blabla2.exe -q -m 1>blabla2.log 2>&1)

where I want the output of the blabla application not the output of the start command.

Is it even possible to have the redirections "local" inside the start command?

Do I have to create a 1 line cmd containing
blabla1.exe -q -m 1>blabla1.log 2>&1
and pass it to the start command?

Update: I need the first one (blabla1.exe) to be finished before I launch the 2nd one (blabla2.exe). That's the reason for using start /wait.

(Windows XP and up)



Solution 1:[1]

Given that you are redirecting output to a file, and waiting for the process to finish, is the extra window started by 'start' actually required? In fact, if there WAS some way to redirect the output when using start, then the windows that popped up wouldn't even have any output...making them even more meaningless.

If not, simply remove the "start /wait" and call the exes directly.

If it IS necessary...then I'm not sure.

UPDATE: I am fairly certain just removing the "start /wait" will produce the behavior you desire. See below:

(Create the following batch file: foo.cmd

:one
notepad.exe
:two
dir

Note that dir will not echo until you close notepad.

Solution 2:[2]

Yes it is possible to redirect output using start wait command using the /B switch.

start /B /wait myprog.exe >> output.log

If you need to break in you will have to use Ctrl+Break, Ctrl+C will be ignored. Hope this helps.

Solution 3:[3]

You need to escape > characters to be evaluated inside start command

start /B /wait myprog.exe ^>^> output.log

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Uwe Keim
Solution 3 Jakub Pawlinski