how to get the logs of a batch file while getting the output on screen as well.
Note my batch file takes several input as well, I tried fair bit of things but its not working, does anyone have some simple solution ?
how to get the logs of a batch file while getting the output on screen as well.
Note my batch file takes several input as well, I tried fair bit of things but its not working, does anyone have some simple solution ?
Use a TEE technique.
Use like this
Replace your
echo
commands withcall :Tee
commandsThis is a bit tricky. So let's disassemble that line to four parts:
The Idea is to print the line to a temporary file (named "_") (second part) then type the contents of that file to screen (third part) then type it to the logfile (fourth part).
Put that all to a variable (first part), so you don't have to type that monsterstring to every line. (this is the reason why the ">" and "&" are escaped with "^")
So every time you use
it will appear on the screen AND write to %logfile%
This also works with commands: