自動清除電腦垃圾及刪除windows預設共用盤符的批處理bat

來源:互聯網
上載者:User

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 了。此後只要你開機,它就自己運行,運行完後就自動結束
如果你想手動,照上做,
想要處理的時候就直接雙擊你的批次檔就行。
最後說一下,批處理的功能很強,批處理的命令不熟不要亂用,很危險,,,,,

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.