服务中心

Good Luck To You!

win日志清理

清理日志01.bat

++++++++++++++++++++++++++++++++++++++++++++++

@echo off 

color 0a

title windows10系统垃圾清理---

echo ★☆ ★☆ ★☆ ★☆ ★☆★☆★☆ ★☆ ★☆ ★☆ ★☆★

echo ★☆ ★☆ ★☆ ★☆ ★☆★☆★☆ ★☆ ★☆ ★☆ ★☆★

echo.★☆                                              ☆★

echo.★☆                                              ☆★

echo.★☆   清理系统垃圾文件,请稍等......             ☆★

echo ★☆                                              ☆★

echo.★☆                                              ☆★

echo ★☆ ★☆ ★☆ ★☆ ★☆★☆★☆ ★☆ ★☆ ★☆ ★☆★

echo ★☆ ★☆ ★☆ ★☆ ★☆★☆★☆ ★☆ ★☆ ★☆ ★☆★

echo 清理垃圾文件,速度由电脑文件大小而定。在没看到结尾信息时 

echo 请勿关闭本窗口。 

echo 正在清除系统垃圾文件,请稍后...... 

echo 删除补丁备份目录 

RD %windir%\$hf_mig$ /Q /S 

echo 把补丁卸载文件夹的名字保存成2950800.txt 

dir %windir%\$NtUninstall* /a:d /b >%windir%\2950800.txt 

echo 从2950800.txt中读取文件夹列表并且删除文件夹 

for /f %%i in (%windir%\2950800.txt) do rd %windir%\%%i /s /q 

echo 删除2950800.txt 

del %windir%\2950800.txt /f /q 

echo 删除补丁安装记录内容(下面的del /f /s /q %systemdrive%\*.log已经包含删除此类文件) 

del %windir%\KB*.log /f /q 

echo 删除系统盘目录下临时文件 

del /f /s /q %systemdrive%\*.tmp 

echo 删除系统盘目录下临时文件 

del /f /s /q %systemdrive%\*._mp 

echo 删除系统盘目录下日志文件 

del /f /s /q %systemdrive%\*.log 

echo 删除系统盘目录下GID文件(属于临时文件,具体作用不详) 

del /f /s /q %systemdrive%\*.gid 

echo 删除系统目录下scandisk(磁盘扫描)留下的无用文件 

del /f /s /q %systemdrive%\*.chk 

echo 删除系统目录下old文件 

del /f /s /q %systemdrive%\*.old 

echo 删除回收站的无用文件 

del /f /s /q %systemdrive%\recycled\*.* 

echo 删除系统目录下备份文件 

del /f /s /q %windir%\*.bak 

echo 删除应用程序临时文件 

del /f /s /q %windir%\prefetch\*.* 

echo 删除系统维护等操作产生的临时文件 

rd /s /q %windir%\temp & md %windir%\temp 

echo 删除当前用户的COOKIE(IE) 

del /f /q %userprofile%\cookies\*.* 

echo 删除internet临时文件 

del /f /s /q "%userprofile%\local settings\temporary internet files\*.*" 

echo 删除当前用户日常操作临时文件 

del /f /s /q "%userprofile%\local settings\temp\*.*" 

echo 删除访问记录(开始菜单中的文档里面的东西) 

del /f /s /q "%userprofile%\recent\*.*" 

echo 

echo ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

echo ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

echo ★☆                                                          ☆★

echo.★☆                                                          ☆★

echo.★☆                                                          ☆★

echo ★☆                                                          ☆★

echo ★☆                恭喜您!清理全部完成!                    ☆★

echo.★☆                                                          ☆★

echo ★☆                                                          ☆★

echo.★☆                                                          ☆★

echo ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

echo ★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

echo.

++++++++++++++++++++++++++++++++++++++++++++++


清理日志02.bat

set task=skdamon.exe
tasklist|find /i "%task%">nul
if %errorlevel% equ 0 (
for /f "eol= delims== tokens=2" %%i in ('wmic process where "name='%task%'" get executablepath /value') do (
rem 指定服务的文件夹路径
set srv_dir=%%~dpi
)
)

rem 日志保留天数
set bak_dat=2

rem 停止服务
net stop SkpSrv
net stop SkpSrv
net stop NisecUk
net stop NisecUk

rem 删除的文件 del用来删除文件 rd用来删除文件夹
forfiles /p %srv_dir%_Log /s /m *.* /d -%bak_dat% /c "cmd /c del /f /s /q /a @path"
forfiles /p %srv_dir%LOG /s /m *.* /d -%bak_dat% /c "cmd /c del /f /s /q /a @path"
forfiles /p %srv_dir%LOG\mq /s /m *.* /d -%bak_dat% /c "cmd /c del /f /s /q /a @path"
forfiles /p %srv_dir%logs /s /m *.* /d -%bak_dat% /c "cmd /c del /f /s /q /a @path"
forfiles /p %srv_dir%logc /s /m *.* /d -%bak_dat% /c "cmd /c del /f /s /q /a @path"

rem 清空回收站 xp
rem for %%a in (recycled recycler) do if exist %systemdrive%\%%a rd /s /q %systemdrive%\%%a\
rem for %%a in (recycled recycler) do if exist %systemdrive%\%%a del /f /s /q /a %systemdrive%\%%a\*.*

rem 清空回收站 win10
rd /s /q c:\$Recycle.Bin
rd /s /q d:\$Recycle.Bin
rd /s /q e:\$Recycle.Bin
rd /s /q f:\$Recycle.Bin
rd /s /q z:\$Recycle.Bin
rem ......

rem 重启服务器
shutdown /r /f /t 0

pause


发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

«    2022年2月    »
123456
78910111213
14151617181920
21222324252627
28
控制面板
您好,欢迎到访网站!
  查看权限
网站分类
搜索
最新留言
    文章归档
    网站收藏
    友情链接
    • Z-BlogPHP
    • 订阅本站的 RSS 2.0 新闻聚合

    Powered By Z-BlogPHP 1.7.1

    Copyright Your WebSite.Some Rights Reserved.