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 containingblabla1.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)
The output of a process can be redirected to a file by typing the command followed by the output redirection operator and file name. When the notation > > filename is added to the end of a command, the output of the command is appended to the specified file name, rather than writing over any existing data.
To redirect the output of a command to a file, type the command, specify the > or the >> operator, and then provide the path to a file you want to the output redirected to. For example, the ls command lists the files and folders in the current directory.
$ echo “Hello” > hello. txt The > command redirects the standard output to a file. Here, “Hello” is entered as the standard input, and is then redirected to the file **… $ cat deserts.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With