开发者

(batch) How to apply the output redirection to the last program of a line?

开发者 https://www.devze.com 2023-01-30 14:19 出处:网络
I have a line, in a batch script, from which I would like to capture the output. I would like to redirect it to a file. My problem is that there are 3 programs in that line, each calling the next. Her

I have a line, in a batch script, from which I would like to capture the output. I would like to redirect it to a file. My problem is that there are 3 programs in that line, each calling the next. Here is the line:

start cmd /C java -jar Prog.jar -remote %1.xml > ProgOut.txt
开发者_JS百科

At the moment, my guess is that the '>' is applied to start, while I would like to get the output of java (I actually get an empty file which is impossible if it is the java output)... I have tried having "" around the java part, but it obviously didn't work. I suppose that having the java command in another batch file would fix my problem, but I'd rather not duplicate script files, if possible.

Thanks!


Your batch file would look like this:

start cmd /C java -jar Prog.jar -remote %1.xml ^> ProgOut.txt

Found this on: http://www.windowsitpro.com/article/tips/jsi-tip-7733-how-do-i-redirect-the-output-of-a-program-that-i-launched-with-the-start-command-.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消