How do I redirect the otuput of a command when it is executed via the Windows START command
I can not figure out how to redirect the output of an executable run with the Windows START command. When I use the following:
start prog.exe par1 par2 par3 > output.file
only the output from the START command goes into output.file
when I want the output from the prog.exe to go to output.file. pro开发者_开发问答g.exe writes output to its standard output.
You need to escape the redirection character so that it is passed through to the inner command. Try this:
start prog.exe par1 par2 par3 ^> output.file
I have the same problem but the esccape ^> didn't work on my side. The original command I try to execute is a .exe batch made on visual studio 2012 with some input variables and options, and works fine when I directly run it:
my_batch.exe --var1=myvar --verbose > c:\my_log.txt 2>&1
So I need to make it work with the "start" command, so with the escape character on > and & I tried:
start my_batch.exe --var1=myvar --verbose ^> c:\my_log.txt 2^>^&1
But I still have the following error, it seams that the redirect character >, and the words after that, are interprated as the next parameters of my_batch.exe instead of the redirection:
Extra parameters specified: >, c:\my_log.txt, 2>&1
Do you have any other leads on that problem? Thanks
精彩评论