科技

2012年3月2日 星期五

[技巧]清除系統垃圾小工具(系統優化)

電腦用久了一定會有許多暫存檔案以及不需用到的東西佔用系統空間

現在就教大家 如何自己製作清除系統垃圾的小工具

首先 打開 windows的記事本

將下面這段文字複製到裡頭


@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%\recycled\*.*
Del /f /s /q %windir%\*.bak
Del /f /s /q %windir%\prefetch\*.*
Rd /s /q %windir%\temp & MD %windir%\temp
Del /f /q %userprofile%\cookies\*.*
Del /f /q %userprofile%\recent\*.*
Del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
Del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
Del /f /s /q "%userprofile%\recent\*.*"
Echo 清除系統垃圾完成!
Echo. & pause

再將它存為副檔名為bat的windows批次處理檔即可

在這邊介紹一下大概的運作


%systemdrive%表示你安裝系統的磁碟機,比如說你裝在C:\,那%systemdrive%="C:"。

%windir%表示你安裝Windows的資料夾,比如說你裝在C:\Windows,

那%windir%="C:\Windows"。

%userprofile%表示使用者的資料夾,比如說你的帳號叫Alan,那設%userprofile%="C:\Documents and Settings\Alan"。
%systemroot%預設等同於%windir%

%AllUsersProfile%表示所有使用者的共用資料夾,預設%AllUsersProfile%="C:\Documents and Settings\All Users"。


刪除:del
/f 強制刪除
/s 包括子目錄
/q 安靜模式,也就是在刪除時不顯示訊息
刪除目錄:rd (rd只能用來移除空目錄,只要目錄中還有檔案,就沒辦法用rd來刪除!)

綜合以上就是清除完系統暫存文件後,再清除使用者所製造的暫存文件。

希望對大家有幫助










沒有留言:

張貼留言