(批处理)如何将输出重定向应用于一行的最后一个程序?

发布于 2024-10-07 11:18:18 字数 329 浏览 0 评论 0原文

我在批处理脚本中有一行,我想从中捕获输出。我想将其重定向到一个文件。我的问题是该行中有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

删除会话 2024-10-14 11:18:19

您的批处理文件将如下所示:

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

找到此: 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:

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文