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
Use /B operator.
This will cause the output to be redirected
start /B /wait myexec.exe > mytext.txt
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With