(批处理)如何将输出重定向应用于一行的最后一个程序?
我在批处理脚本中有一行,我想从中捕获输出。我想将其重定向到一个文件。我的问题是该行中有 3 个程序,每个程序都调用下一个程序。这是一行:
start cmd /C java -jar Prog.jar -remote %1.xml > ProgOut.txt
目前,我的猜测是 '>'应用于启动,而我想获得java的输出(我实际上得到一个空文件,如果它是java输出,这是不可能的)...我尝试在java部分周围有“”,但它显然没有不工作。我想在另一个批处理文件中使用 java 命令可以解决我的问题,但如果可能的话,我宁愿不重复脚本文件。
谢谢!
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
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的批处理文件将如下所示:
找到此: 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
Your batch file would look like this:
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