I have the following in a Windows batch file
my_app < "%%PARAMETER_FOR_APP"
The application executes succesfully, and outputs three lines to the console.
I want to capture that output so as to be able to save it to a log file.
I am trying this:
set LOG_FILE_NAME = mylog.log
my_app < "%%PARAMETER_FOR_APP" > COMMAND_OUTPUT
echo %COMMAND_OUTPUT%
echo %COMMAND_OUTPUT% >> %LOG_FILE_NAME%
I am expecting a variable, COMMAND_OUTPUT
, to be created, which I can then use with the eccho command. But instead an empty file, COMMAND_OUTPUT
, is created on the file system.
What is the correct way to do this?