@echo off setlocal set logfile=Log.log if not "%1" == "/nolog" ( ( date /t & time /t call %0 /nolog ) >> %logfile% 2>&1 type %logfile% endlocal exit /b ) ... your batch file starts here...
It is much easier to achieve this in a PowerShell script by using the Start-Transcript cmdlet. Tee-Object may also be handy, because it can display the output onto the screen as well as writing to a file.
0 comments:
Post a Comment