Dos批處理編寫一鍵清理系統(tǒng)垃圾的bat代碼
del 命令的參數(shù)
/F 強(qiáng)制刪除只讀文件。
/S 從所有子目錄刪除指定文件。
/Q 安靜模式。刪除全局通配符時(shí),不要求確認(rèn)。
rd 命令的參數(shù)
/s 除目錄本身外,還將刪除指定目錄下的所有子目錄和文件。用于刪除目錄樹。
/q 安靜模式
/s 刪除目錄樹時(shí)不要求確認(rèn)。
代碼一
@echo off & title 清理系統(tǒng)垃圾 del /f /s /q %systemdrive%\*.tmp del /f /s /q %systemdrive%\*.mp3 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 /s /q "C:\Documents and Settings\Administrator\Local Settings\History" del /f /s /q "C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files" del /f /s /q "C:\Documents and Settings\Administrator\Local Settings\Temp" del /f /s /q "C:\Documents and Settings\Administrator\Local Settings\Temp\_xl7vss_" del /f /s /q "D:\Program Files\QvodPlayer\Data"
代碼二
@echo off echo 正在清理系統(tǒng)垃圾文件,請稍等...... 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 清理系統(tǒng)垃圾完成!
然后把上面的內(nèi)容保存為 清理垃圾批處理.bat,當(dāng)然大家可以根據(jù)自己的需求增減目錄或文件類型即可。
相關(guān)文章
dos命令行設(shè)置IE代理的實(shí)現(xiàn)代碼
這篇文章主要介紹了dos命令行設(shè)置IE代理的實(shí)現(xiàn)代碼,需要的朋友可以參考下2016-12-12
用批處理實(shí)現(xiàn)讀取文本文件并實(shí)現(xiàn)超鏈接代碼的輸出
今天用chm反編譯軟件實(shí)現(xiàn)了輸出所以文章類別功能,可是沒有index索引頁,還好都是中文文章名,我想讓這每行文本都是以超連接的形式顯示到頁面中,實(shí)現(xiàn)索引2008-06-06
Win10利用bat文件實(shí)現(xiàn)文件與文件夾批量重命名的實(shí)踐
本文主要介紹了Win10利用bat文件實(shí)現(xiàn)文件與文件夾批量重命名的實(shí)踐,這樣就免去了通過寫一個(gè)腳本,或者代碼程序來運(yùn)行,具有一定的參考價(jià)值,感興趣的可以了解一下2022-04-04

