如何从重定向输出exe文件已经结束之后? [英] How to redirect output from exe after it has terminated?

查看:381
本文介绍了如何从重定向输出exe文件已经结束之后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想保存的批处理文件到一个文本文件中执行一个exe文件的输出。
我尝试了以下方法,但他们不工作

这不工作,因为我回来在命令提示符下,同时应用程序运行和创建的文本文件是空的。

C:\\> myexec.exe> mytext.txt

C:\\> _

C:\\>状态:通过

这也不起作用。我得到一个空的文本文件,并没有输出。

C:\\>启动/等待myexec.exe> mytext.txt

C:\\>调用start /等待myexec.exe> mytext.txt

这给了我一个输出至少为:

  C:\\>启动/等待myexec.exe
状态传递


解决方案

我有同样的问题,解决它像这样:

bat文件内容

START /等待CMD / CF:\\ MyInstaller \\ Installer.exe的> log.txt的

回声这将在previous完成后得到记录> log1.txt

I'm trying to save the output of an exe file executed within a batch file to a text file. I've tried the the following methods but they don't work

This doesn't work since I'm back at the command prompt while the application runs and the text file created is blank.

C:\>myexec.exe > mytext.txt

C:\>_

C:\>Status: Passed

These also doesn't work. I get an empty text file and no output.

C:\>start /wait myexec.exe > mytext.txt

C:\>call start /wait myexec.exe > mytext.txt

This gives me an output at least:

C:\>start /wait myexec.exe
Status Passed

解决方案

I had the same issue and solved it like this:

bat file content

START /wait cmd /c "F:\MyInstaller\installer.exe > log.txt"

echo This will get logged after the previous is completed > log1.txt

这篇关于如何从重定向输出exe文件已经结束之后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆