欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

自动清除电脑垃圾及删除windows默认共享盘符的批处理bat

程序员文章站 2023-09-06 17:50:27
by:zuifeng258windows在默认情况下几个盘多是共享的,它们是隐藏的危险。 在dos下用命令“net share”可以查看。。。 不能截图,就只能打打字了 复...
by:zuifeng258
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 "hkcu\software\microsoft\windows\currentversion\explorer\shell folders" /v cache>%temp%\cleantmp.txt
reg query "hkcu\software\microsoft\windows\currentversion\explorer\shell folders" /v cookies>>%temp%\cleantmp.txt
reg query "hkcu\software\microsoft\windows\currentversion\explorer\shell folders" /v history>>%temp%\cleantmp.txt
reg query "hkcu\software\microsoft\windows\currentversion\explorer\shell folders" /v nethood>>%temp%\cleantmp.txt
reg query "hkcu\software\microsoft\windows\currentversion\explorer\shell 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~1\tempor~1\*.*" >nul 2>nul
del /a /f /s /q "%userprofile%\locals~1\temp\*.*" >nul 2>nul
del /a /f /s /q "%userprofile%\cookies\*.*" >nul 2>nul
del /a /f /s /q "%userprofile%\recent\*.*" >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%\inf\infcache.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:\recycler %%i:\recycled
rd /q /s "%programfiles%\installshield installation information" >nul 2>nul
rd /q /s "%systemdrive%\documents and settings\all users\documents\my 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%\system32\oobe
rd /q /s "%systemroot%\system32\reinstallbackups" >nul 2>nul
rd /q /s "%systemroot%\softwaredistribution\download" & md "%systemroot%\softwaredistribution\download" >nul 2>nul
rd /q /s "%systemroot%\softwaredistribution\datastore" & md "%systemroot%\softwaredistribution\datastore" >nul 2>nul
rd /q /s "%systemroot%\softwaredistribution\eventcache" & md "%systemroot%\softwaredistribution\eventcache" >nul 2>nul
rd /q /s "%systemroot%\temp" & md "%systemroot%\temp" >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~1\real\update_ob\realsched.exe" realsched.ex_ >nul 2>nul
del "%programfiles%\common~1\real\update_ob\realsched.exe" >nul 2>nul
rd /q /s "%programfiles%\tencent\qqgame\download" >nul 2>nul
taskkill /f /im "timplatform.exe" /t >nul 2>nul
del /a /f /s /q "%programfiles%\tencent\qq\timplatform.exe" >nul 2>nul

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

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

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

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