當前位置:係統粉 >  係統教程 > 電腦軟件教程 >  xp係統清理bat|xp用bat清理係統來及的方法

xp係統清理bat|xp用bat清理係統來及的方法

時間:2017-02-18 來源:互聯網 瀏覽量:

在電腦用久了容易變慢,其中除上“不小心”被安裝了很多軟件或插件外,另一重要的原因是我們用電腦遺留下來的垃圾文件,比如操作電腦產生的DLL或PF文件、打開OFFICE產生的臨時文件、瀏覽網頁產生的網頁文件等。雖然這些操作完全可以用360等工具來清理,但如果我們能否自己寫個程序來實現呢?答案是肯定,尤其是在公司加入域環境的很多人共用的電腦上,我們完全可以按需編寫需要的功能。這裏做一常用的bat程序,僅作拋磚引玉之用。


xp用bat清理係統來及的方法:

1、首先,打開記事本。點擊“開始”菜單,在“搜索程序和文件”文本框中輸入“notepad”,並按回車,打開記事本:

xp係統清理bat,步驟1

2、如果你是在XP係統下,或是你的Win7係統優化掉了“搜索程序和文件”功能,則需要點擊“運行”命令,並按回車打開記事本:

xp係統清理bat,步驟2

3、然後,將以下內容複製並粘貼到打開的記事本中:

@ECHO off

color 0a

REM 優化更為徹底——可全自動刪除域環境下所有本地帳戶下的垃圾文件、自動刪除係統更新遺留的補

丁文件

REM 針對家庭使用,增加了係統優化功能——自動判斷是否需要優化,減少資源占用

::echo 當前帳戶:%username%

ECHO.

ECHO ==本程序用於服務器時具有相當的危險性,請參照本程序源碼REM操作!==

ECHO Log和Bak清理部分對於服務器和實驗機台請勿使用!

echo 禁止java後台更新程序自啟動

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v SunJavaUpdateSched /f >nul 2>nul

echo 禁止Adobe Reader升級程序自啟動

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v "Adobe ARM" /f >nul 2>nul

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v "Adobe Reader Speed Launcher" /f >nul 2>nul

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Reader_sl /f >nul 2>nul

echo 禁止飛信自啟動

reg delete HKEY_LOCAL_user\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Fetion /f >nul 2>nul

echo 禁止係統配置程序員自啟動

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v MSConfig /f >nul 2>nul

echo 禁止日語輸入法自啟動

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v IMJPMIG8.1 /f >nul 2>nul

echo 禁止微軟多語言支持自啟動

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v IMEKRMIG6.1 /f >nul 2>nul

echo 禁止微軟IME輸入法組件自啟動

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v IMSCMig /f >nul 2>nul

echo 禁止同步自啟動

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v "Synchronization Manager" /f >nul 2>nul

echo 禁止微軟拚音輸入法2002自啟動

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v MSPY2002 /f >nul 2>nul

echo 禁止微軟拚音輸入法組件自啟動

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v PHIME2002A /f >nul 2>nul

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v PHIME2002ASync /f >nul 2>nul

reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v "Microsoft Pinyin IME Migration" /f >nul 2>nul

TITLE 清理.bak備份文件-謹慎操作!

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

REM 用於服務器時請勿刪除日誌!-謹慎操作!

TITLE 用於服務器時請勿刪除日誌!-謹慎操作!

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

REM 勿使用rd /s /q %windir%\temp & md %windir%\temp命令,否則服務器服務(如DB)容易出現問題!

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

REM 若要清理幫助文件,將下麵的::刪除即可

rd /s /q "%windir%\help"

ECHO ::1.清理局域網共享痕跡--注冊表::

TITLE ::1.清理局域網共享痕跡--注冊表::

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\WorkgroupCrawler\Shares" /f >nul 2>nul 

ECHO ::2.清理運行或操作曆史記錄--注冊表::

TITLE ::2.清理運行或操作曆史記錄--注冊表::

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\Folder" /va /f >nul 2>nul 

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.txt" /va /f >nul 2>nul  

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.rar" /va /f >nul 2>nul

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.mp3" /va /f >nul 2>nul 

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.jpg" /va /f >nul 2>nul 

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.ini" /va /f >nul 2>nul  

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.bmp" /va /f >nul 2>nul

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.doc" /va /f >nul 2>nul  

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.eip" /va /f >nul 2>nul

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.htm" /va /f >nul 2>nul  

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.ico" /va /f >nul 2>nul  

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.inf" /va /f >nul 2>nul  

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.gif" /va /f >nul 2>nul  

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.wav" /va /f >nul 2>nul  

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.xls" /va /f >nul 2>nul  

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs\.rm" /va /f >nul 2>nul  

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RecentDocs" /va /f >nul 2>nul

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\LastVisitedMRU" /va /f >nul 2>nul  

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\*" /va /f >nul 2>nul  

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\mp3" /va /f >nul 2>nul

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\rm" /va /f >nul 2>nul 

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\wav" /va /f >nul 2>nul  

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\bat" /va /f >nul 2>nul

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\exe" /va /f >nul 2>nul 

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\eip" /va /f >nul 2>nul 

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\ico" /va /f >nul 2>nul 

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\htm" /va /f >nul 2>nul  

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\jpg" /va /f >nul 2>nul 

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU" /va /f >nul 2>nul

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StreamMRU" /va /f >nul 2>nul 

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{5E6AB780-7743-11CF-A12B-00AA004AE837}\Count" /va /f >nul 2>nul 

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\{75048700-EF1F-11D0-9888-006097DEACF9}\Count" /va /f >nul 2>nul 

reg delete "HKCU\Software\WinRAR\ArcHistory" /va /f >nul 2>nul 

reg delete "HKCU\Software\WinRAR\DialogEditHistory\ArcName" /va /f >nul 2>nul

reg delete "HKCU\Software\WinRAR\DialogEditHistory\ExtrPath" /va /f >nul 2>nul 

reg delete "HKCU\Software\Microsoft\MediaPlayer\Player\RecentFileList" /va /f >nul 2>nul 

reg delete "HKCU\Software\Microsoft\Microsoft Management Console\Recent File List" /va /f >nul 2>nul 

reg delete "HKCU\Software\Microsoft\Office\11.0\PowerPoint\Recent File List" /va /f >nul 2>nul

reg delete "HKCU\Software\Microsoft\Office\11.0\Excel\Recent File" /va /f >nul 2>nul

reg delete "HKCU\Software\Microsoft\Office\11.0\Word\Data" /v "Settings" /f >nul 2>nul

reg delete "HKCU\Software\VMware, Inc." /va /f >nul 2>nul

ECHO ::3.清理IE瀏覽曆史的下拉列表--注冊表::

TITLE ::3.清理IE瀏覽曆史的下拉列表--注冊表::

reg delete "HKCU\Software\Microsoft\Internet Explorer\TypedUrls" /va /f >nul 2>nul

ECHO ::4.正在清理常見係統垃圾文件,請退出360等程序::

TITLE ::4.正在清理常見係統垃圾文件,請退出360等程序::

del /f /q "%ALLUSERSPROFILE%\Documents\DrWatson\*.*">nul 2>nul 

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

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

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

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

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

del /f /s /q %systemdrive%\thumbs.db

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

del /f /s /q %windir%\system32\dllcache\*.*

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

cls

ECHO ::5.為安全起見,以下清理操作隻對當前登錄帳戶有效::

TITLE ::5.為安全起見,以下清理操作隻對當前登錄帳戶有效::

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

ECHO ::6.清理文件緩存::

TITLE ::6.清理文件緩存::

SFC /purgecache

cls

ECHO ::7.清理係統升級補丁目錄::

TITLE ::7.清理係統升級補丁目錄::

dir %SystemRoot%\$*$ /ad/b >%SystemRoot%\DirTmp.txt 

for /f %%a in (%SystemRoot%\DirTmp.txt) do rd /s /q "%SystemRoot%\%%a" 

del /f /q %SystemRoot%\DirTmp.txt

cls

ECHO ::8.清理磁盤錯誤檢測文件::

TITLE ::8.清理磁盤錯誤檢測文件::

dir %SystemDrive%\found.??? /ad/b >%systemDrive%\DirTmp.txt 

for /f %%a in (%systemDrive%\DirTmp.txt) do rd /s /q "%systemDrive%\%%a" 

del /f /q %systemDrive%\DirTmp.txt

cls

ECHO ::9.正在清理所有(域)帳戶下的所有臨時文件,請稍候::

TITLE ::9.正在清理所有(域)帳戶下的所有臨時文件,請稍候::

dir "%SystemDrive%\Documents and Settings\" /ad/b >%SystemDrive%\DirTmp.txt 

for /f %%a in (%SystemDrive%\DirTmp.txt) do del /f /s /q "%SystemDrive%\Documents and Settings\%%a\Cookies\*.*"&del /f /s /q "%SystemDrive%\Documents and

Settings\%%a\Recent\*.*"&rd /s /q "%SystemDrive%\Documents and Settings\%%a\Local Settings\History\"&del /f /s /q "%SystemDrive%\Documents and Settings\%%

a\Local Settings\Temp\*.*"&del /f /s /q "%SystemDrive%\Documents and Settings\%%a\Local Settings\Temporary Internet Files\*.*"

del /f /q %SystemDrive%\DirTmp.txt

cls

ECHO ::10.刪除係統驅動備份文件,釋放空間::

TITLE ::10.刪除係統驅動備份文件,釋放空間::

rd /s /q %SystemDrive%\swsetup\

ECHO ::11.正在進行係統優化::

TITLE ::11.正在進行係統優化::

reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v TkBellExe /f

cls

ECHO ::12.正在進行最後一步——磁盤清理,完成後自動退出::

ECHO   當耗時越長時,說明你係統垃圾越多,請耐心等待程序執行完畢。。。

TITLE ::12.正在進行最後一步——磁盤清理,完成後自動退出::

cleanmgr /sagerun:99

exit

4、再單擊記事本中的“文件”菜單,在彈出的菜單中“另存為”命令:

xp係統清理bat,步驟4

5、最關鍵的一步:在彈出的“另存為”對話框中,一定要選擇“保存類型”為“所有文件”,然後在“文件名”中輸入文件名並加上bat程序專用擴展名“.bat”,如下圖:

xp係統清理bat,步驟5

6、至此,清理係統垃圾的bat程序已經製作完成,我們打開保存的目錄,並右擊這個“Bat清理係統垃圾.bat”程序,從彈出的菜單中選擇“以管理員身份運行”(如果是在Vista、win7 or more係統下):

xp係統清理bat,步驟6

7、注意,如果沒有選擇“以管理員身份運行”,則程序在執行過程中會顯示“拒絕訪問”,同時很多垃圾文件將不能清理幹淨,

xp係統清理bat,步驟7

8、選擇“以管理員身份運行”後,係統彈出“用戶帳戶控製”對話框,我們選擇“是”既可:

xp係統清理bat,步驟8

9、然後程序即會開始執行:

xp係統清理bat,步驟9

10、因程序中使用了“reg”命令清理注冊表垃圾,所以360安全衛士會彈出危險警告,務必要選擇“允許程序的所有操作”,否則注冊表垃圾不能被清理:

xp係統清理bat,步驟10

11、待程序執行完畢後,會自動關閉這個窗口。


【xp係統清理bat】這就跟大家分享完了,如果身邊有朋友遇到同樣的電腦使用疑問的話,可以將上述教程分享出去。還有其他的windows係統下載後操作的疑問的話,歡迎上係統粉官網查找解決的對策。

我要分享:
版權信息

Copyright @ 2011 係統粉 版權聲明 最新發布內容 網站導航