1.

Solve : Screen Output plus Logging in batch file?

Answer»

Hi

I WANT to run my batch script and at the same time print the echo's on screen as well as log them into a file. I could do it INDIVIDUALLY, i.e. either print the output on screen or log to a file but not both at the same time. How it can be achieved?

Any help is appreciated.

regardsyou can do a logging function in your batch file:

Code: [SELECT]:FCT_LOG
echo %1
echo %1 >> file.txt
GOTO :EOF

that you will call once when needed:

Code: [Select]CALL :FCT_LOG "message to log"

this will at least prevents that you duplicate all your messages

hope this helps
ypHi, Thanks a LOT for the input. I would definetly use your idea, it looks promising. But luckily I use cygwin so I just created one more bat file and called the original as under;

file2.bat ! TEE txt.log

regards



Discussion

No Comment Found