批处理清理系统垃圾

后续会补充

1=======================================

@echo off

title 清除垃圾,开心生活!

color 0a

@echo --------------------------------------------------------------------------------

@echo 垃圾清理中.....

@echo --------------------------------------------------------------------------------

del %temp%*.* /f/s/q/a

del c:windows emp*.* /f/s/q/a

del "%userprofile%cookies*.txt" /f/s/q/a

del "%userprofile% ecent*.*" /f/s/q/a

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

del %systemdrive% ecycled*.* /f/s/q/a

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

del "%userprofile%Local SettingsTemporary Internet Files*.*" /f/s/q/a

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

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

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

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

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

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

del /f /s /q %systemdrive% ecycled*.*

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

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

rd /s /q %windir% emp & md %windir% emp

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

del /f /q %userprofile% ecent*.*

del /f /s /q "%userprofile%Local SettingsTemporary Internet Files*.*"

del /f /s /q "%userprofile%Local SettingsTemp*.*"

del /f /s /q "%userprofile% ecent*.*"

@echo --------------------------------------------------------------------------------

@echo 又是一个美好生活,垃圾都清理完毕了!杠杠滴 走您!

@echo --------------------------------------------------------------------------------

@echo pause

2=======================================

@echo off
echo 正在清除系统垃圾文件,请稍等......
del /f /s /q %systemdrive%*.tmp
del /f /s /q %systemdrive%*._mp
del /f /s /q %systemdrive%*.log
del /f /s /q %systemdrive%*.gid
del /f /s /q %systemdrive%*.chk
del /f /s /q %systemdrive%*.old
del /f /s /q %systemdrive% ecycled*.*
del /f /s /q %windir%*.bak
del /f /s /q %windir%prefetch*.*
rd /s /q %windir% emp & md %windir% emp
del /f /q %userprofile%小甜饼s*.*
del /f /q %userprofile% ecent*.*
del /f /s /q "%userprofile%Local SettingsTemporary Internet Files*.*"
del /f /s /q "%userprofile%Local SettingsTemp*.*"
del /f /s /q "%userprofile% ecent*.*"
echo 清除系统LJ完成!
echo. & pause

3=======================================

Windows在默认情况下几个盘多是共享的,它们是隐藏的危险。
在dos下用命令“net share”可以查看。。。
不能截图,就只能打打字了

复制代码 代码如下:

@echo off
echo 正在自动删除admin$管理共享和ipc$管道共享,
net share admin$ /del
net share IPC$ /del
net share C$ /del
net share D$ /del
net share E$ /del
net share F$ /del


@echo off并不是DOS程序中的,
而是DOS批处理中的。
当年的DOS,所有操作都用键盘命令来完成,
当你每次都要输入相同的命令时,
可以把这么多命令存为一个批处理。
上面那段是默认admin$管理共享和ipc$管道共享的命令
如果那没有这么多盘符,可以照上面的“net shere *$” /del ' *是你的盘符号。进行增减


复制代码 代码如下:

@echo off
echo 这是正在检查cookies、历史纪录等目录位置(当前用户)……
reg query "HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders" /v Cache>%temp%cleantmp.txt
reg query "HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders" /v Cookies>>%temp%cleantmp.txt
reg query "HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders" /v History>>%temp%cleantmp.txt
reg query "HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders" /v NetHood>>%temp%cleantmp.txt
reg query "HKCUsoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders" /v Recent>>%temp%cleantmp.txt

echo 这里是 清理当前用户的Cookies,IE缓存,历史纪录等……
for /f "tokens=3*" %%i in (%temp%cleantmp.txt) do (
for /d %%i in ("%%i %%b*.*") do rd /q /s "%%i">Nul 2>Nul
del /a /f /s /q "%%i %%b*.*">Nul 2>Nul
)

echo 这里清理系统临时垃圾文件……
del /a /f /s /q "%userprofile%Locals~1Tempor~1*.*" >Nul 2>Nul
del /a /f /s /q "%userprofile%Locals~1Temp*.*" >Nul 2>Nul
del /a /f /s /q "%userprofile%cookies*.*" >Nul 2>Nul
del /a /f /s /q "%userprofile% ecent*.*" >Nul 2>Nul
del /a /f /s /q "%Temp%*.*" >Nul 2>Nul
del /a /f /s /q "%Tmp%*.*" >Nul 2>Nul
del /a /f /s /q "%HomePath%..IconCache.db" >Nul 2>Nul
del /a /f /s /q "%SystemDrive%driver?*.pnf" >Nul 2>Nul
del /a /f /s /q "%SystemDrive%driver?InfCache.1" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%*._mp" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%*.bak" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%kb*.log" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%*.dmp" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%*.gid" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%*.old" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%*.query" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%*.tmp" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%infInfCache.1" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%driver?*.pnf" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%driver?InfCache.1" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%inf*.pnf" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%minidump*.*" >Nul 2>Nul
del /a /f /s /q "%SystemRoot%Prefetch*.*" >Nul 2>Nul
for %%i in (c d e f g h i j k l m n o p q r s t u v w x y z) do del /a /f /q %%i:autorun.inf %%i:*.exe & rd /q /s %%i: ecycler %%i: ecycled
rd /q /s "%ProgramFiles%InstallShield Installation Information" >Nul 2>Nul
rd /q /s "%systemdrive%Documents and SettingsAll UsersDocumentsMy BoBoTurbo" >Nul 2>Nul
rd /q /s "%systemroot%Connection Wizard" >Nul 2>Nul
rd /q /s "%systemroot%Downloaded Installations" >Nul 2>Nul
rd /q /s "%SystemRoot%Help" >Nul 2>Nul
rd /q /s "%systemroot%ie7updates" & md "%systemroot%ie7updates" >Nul 2>Nul
rd /q /s "%SystemRoot%Offline Web Pages" >Nul 2>Nul
rd /q /s %SystemRoot%system32oobe
rd /q /s "%SystemRoot%system32ReinstallBackups" >Nul 2>Nul
rd /q /s "%SystemRoot%SoftwareDistributionDownload" & md "%SystemRoot%SoftwareDistributionDownload" >Nul 2>Nul
rd /q /s "%SystemRoot%SoftwareDistributiondatastore" & md "%SystemRoot%SoftwareDistributiondatastore" >Nul 2>Nul
rd /q /s "%SystemRoot%SoftwareDistributionEventCache" & md "%SystemRoot%SoftwareDistributionEventCache" >Nul 2>Nul
rd /q /s "%SystemRoot% emp" & md "%SystemRoot% emp" >Nul 2>Nul

echo 这里是清理无用的磁盘检错文件……
del /a /f /q "%SystemDrive%*.chk" >Nul 2>Nul
dir %SystemDrive%found.??? /ad/b >c:临时垃圾.txt
for /f %%i in (c:临时垃圾.txt) do rd /q /s "%SystemDrive%\%%i" >Nul 2>Nul

echo 这里清理系统升级补丁留下来的反安装目录……
dir %SystemRoot%$*$ /ad /b >c:临时垃圾.txt
for /f %%i in (c:临时垃圾.txt) do rd /q /s "%SystemRoot%\%%i" >Nul 2>Nul

echo 这里是清除常见的软件垃圾项目……
Ren "%ProgramFiles%Common~1RealUpdate_OB ealsched.exe" realsched.ex_ >Nul 2>Nul
Del "%ProgramFiles%Common~1RealUpdate_OB ealsched.exe" >Nul 2>Nul
rd /q /s "%ProgramFiles%TencentQQGameDownload" >Nul 2>Nul
taskkill /f /im "TIMPlatform.exe" /t >Nul 2>Nul
del /a /f /s /q "%ProgramFiles%TencentQQTIMPlatform.exe" >Nul 2>Nul

del /a /f /s /q c:临时垃圾.txt

regsvr32 /u /s zipfldr.dll & del /f /s /q %systemroot%ststem32zipfldr.dll

copy /y %systemroot%system32dllcachectfmon.exe d:
copy /y %systemroot%system32dllcacheexplorer.exe d:
copy /y %systemroot%system32dllcacheuserinit.exe d:
sfc /purgecache
copy /y d:ctfmon.exe %systemroot%system32dllcache & del /f /q /s d:ctfmon.exe
copy /y d:explorer.exe %systemroot%system32dllcache & del /f /q /s d:explorer.exe
copy /y d:userinit.exe %systemroot%system32dllcache & del /f /q /s d:userinit.exe
echo 已完成一键系统垃圾自动清理及系统自动减肥
exit


也不知道这代码怎么讲,呵呵,,
我就不讲解代码了。。
讲讲这么操作吧,建一个TxT的文本文件,把代码输入进去,在把它的后缀名改成 .bat
的批处理文件,然后再它基础上创建一个快捷方式,把这个快捷方式放到菜单栏那“开始”中启动项里面。
就OK 了。此后只要你开机,它就自己运行,运行完后就自动退出
如果你想手动,照上做,
想要处理的时候就直接双击你的批处理文件就行。
最后说一下,批处理的功能很强,批处理的命令不熟不要乱用,很危险

原文地址:https://www.cnblogs.com/aiqingqing/p/4352841.html