码迷,mamicode.com
首页 > 其他好文 > 详细

日志清理批处理

时间:2016-05-31 20:32:41      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:

@echo off
echo on error resume next>clear.vbs
echo set wmi_clear=getobject("winmgmts:\\.\root\cimv2")>>clear.vbs
echo dim lianan_names(2)>>clear.vbs
echo lianan_names(0)="application">>clear.vbs
echo lianan_names(1)="security">>clear.vbs
echo lianan_names(2)="system">>clear.vbs
echo for each lianan_name in lianan_names>>clear.vbs
echo set lianan_logs=wmi_clear.execquery("select * from win32_nteventlogfile where logfilename=‘"^&lianan_name^&"")>>clear.vbs
echo for each lianan_log in lianan_logs>>clear.vbs
echo lianan_log.cleareventlog()>>clear.vbs
echo next>>clear.vbs
echo next>>clear.vbs
echo 创建文件完毕!
echo 正在清除日志...
clear.vbs
echo 清除日志完毕!
echo 删除创建的文件
del /f /q clear.vbs
echo 日志清除完毕
pause

 

日志清理批处理

标签:

原文地址:http://www.cnblogs.com/hookjoy/p/5547218.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!