Windows 7 How to make a Log file of a Batch Job
Here is a simple '*.Bat' file.
It runs just fine, however there are times
when it doesn't complete.
Years ago I used ASCII log files of working
batch jobs to see what was going on.
I would like to do the same in Windows-7.
So, how do you do that ?
Many Thanks.
Sincerely,
Ed505
= = = = = = = = = = = = = Start Batch File = = = = = = = = = = =
REM Test
REM This a test to copy a few XLS files and make a Log file.
REM Test
REM
REM z2Test.bat > z2Test.log - This didn't work. It just hung the batch job
REM
REM The set logfile didn't seem to do anything.
REM
set logfile = c:\paaru\batch\zzzTestlog.log
echo Test Batch File %0 % >%logfile%%
C:
cd \Paaru\Batch\Save\
set parvar=%date:~-4%%date:~-10,2%%date:~-7,2%%time:~0,2%%time:~3,2%%time:~6,2%
set parvar=%parvar: =0%
echo The work variable is equal to l%parvar%l
md %parvar%
xcopy c:\Paaru\deep\*.xls %parvar%\*.* /v /y
cd \Paaru\Batch\cmd\
exit /b
= = = = = = = = = = = = = Start Batch File = = = = = = = = = = =
Ed505
May 20th, 2012 1:41pm
Well I found an answer from some old, old XP site.
It works, though I wonder if there is a better way ?
The bold text is what did the trick.
BTW, is there a way to change the font on this site.
Thanks. . .
= = = = = = = = = = Start of Batch File = = = = = = = = =
@ECHO ON
rem
call :Logit>>C:\Paaru\Batch\log\batch.log 2>&1
:Logit
echo Backup Start at = %date% %time%
C:
cd \Paaru\Batch\Save\
set parvar=%date:~-4%%date:~-10,2%%date:~-7,2%%time:~0,2%%time:~3,2%%time:~6,2%
set parvar=%parvar: =0%
rem The work variable is equal to ~%parvar%~
md %parvar%
xcopy c:\Paaru\deep\*.xls %parvar%\*.* /v /y
cd \Paaru\Batch\cmd\
echo Backup Complete at = %date% %time%
exit /b
= = = = = = = = = = End of Batch File = = = = = = = =
.
Ed505
Free Windows Admin Tool Kit Click here and download it now
May 20th, 2012 9:46pm