1.windows进程存活循环监测


@echo off
echo ----------正在检测-------
:start
choice /t 5 /d y /n >nul
tasklist|find /i "WeChat.exe"
if %errorlevel%==0 (
    echo "running"
) else (
    echo "stopped"
    start startup.bat (新窗口启动startup.bat脚本)
)
goto start

2.清理日志文件

仅保留(/d  -30)30天之内的日志


@echo off
for %%I in ("D:\123\test\Log"
"D:\web\log\"
"D:\test\test12\Log"
.
.
.
 
.)  do timeout 3 && forfiles /p %%I /s /m *.* /d -30 /c "cmd /c del /f /q /a @path"
 
pause

更多推荐