一直困扰的问题,如何在使用重定向功能生成的Log日志,最新的保持在第一行。请教有何方法,并保持日志文件的属性如创建时间。- ::
- :: =================================================
- :: Check the physical harddisk on HP DL388 and X64
- :: in case any error or fail
- :: Need to run with HP Array Configuration Utility CLI
- :: =================================================
- ::
- @echo off
-
- "C:\Program Files (x86)\Compaq\Hpacucli\bin\hpacucli.exe" ctrl slot=0 pd all show > zPdfailinfo.log
-
- find "Fail" zPdfailinfo.log
-
- if %ERRORLEVEL% == 0 (goto zNotify)
-
- find "Error" zPdfailinfo.log
-
- if %ERRORLEVEL% == 0 (goto zNotify) else (goto zExit)
-
-
- :zExit
- @ECHO.Running at %date% %time:~0,5% with no error >> zHDcheck.log
- exit /B
-
- :zNotify
- @ECHO.Running at %date% %time:~0,5% with error, pls check >> zHDcheck.log
- zSendmail.vbs
复制代码 zHDcheck.log
Running at 2015-10-25 Sun 9:35 with no error
Running at 2015-10-26 Mon 9:35 with no error
Running at 2015-10-27 Tue 9:35 with no error
Running at 2015-10-28 Wed 9:35 with no error
期望:
zHDcheck.log
Running at 2015-10-28 Wed 9:35 with no error
Running at 2015-10-27 Tue 9:35 with no error
Running at 2015-10-26 Mon 9:35 with no error
Running at 2015-10-25 Sun 9:35 with no error |