大部分深度系統用戶都知道,電腦使用久了以后,會產生很多垃圾緩存,如果垃圾文件沒及時清理干凈,會導致電腦運行的越來越慢的問題。這不關于此問題,win10官網就分享出一件清理系統垃圾的方法。下面深度技術官網小編就來分享具體的詳細方法。
方法如下:
1、右鍵新建記事本文件.
2、在記事本文件中復制——粘貼下面的代碼:
@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
3、記事本另存為“系統清理.bat”(文件名可自定,文件擴展名必須是.bat),另存為時“保存類型”選擇“所有文件”。
4、雙擊保存的“系統清理.bat”文件即可運行,清理結束后按任意鍵。
以上就是深度技術系統分享關于win10系統中一鍵清理系統垃圾的詳細方法,希望可以幫助到有需要的朋友。
這個程序是一個用 Python 編寫的實用工具,旨在幫助清理 Windows 10 操作系統中的不同類型的緩存文件,包括臨時文件、日志文件以及 Windows 更新緩存。通過運行這個程序,用戶可以輕松地減少磁盤空間占用,提高系統性能,并確保操作系統保持整潔。
程序包含以下主要功能:
清除臨時文件: 通過調用 Windows 的 cleanmgr 命令,程序可以清除操作系統中的臨時文件,這些文件通常占用大量磁盤空間。
清除日志文件: 使用命令行操作,程序能夠刪除 Windows 操作系統中的日志文件,以釋放磁盤空間并提高系統效率。
清除 Windows 更新緩存: 程序會停止 Windows 更新服務 (wuauserv),然后刪除 Windows 更新緩存文件夾 (C:\Windows\SoftwareDistribution) 中的內容,最后重新啟動 Windows 更新服務。這有助于解決更新問題和釋放存儲空間。
這個程序對于那些希望維護其 Windows 10 操作系統并確保其性能達到最佳水平的用戶來說非常有用。但請注意,在運行程序之前,請謹慎考慮,確保備份重要數據,以免不小心刪除文件。同時,以管理員權限運行程序,以確保成功執行清除操作。
以下是程序的源代碼:
import os
import subprocess
def clear_temp_files():
try:
# 清除臨時文件
subprocess.run(["cleanmgr", "/sagerun:1"], capture_output=True, text=True)
print("臨時文件已清除")
except Exception as e:
print(f"清除臨時文件時出錯:{e}")
def clear_log_files():
try:
# 清除 Windows 日志文件
subprocess.run(["del", "C:\\Windows\\Logs\\*.*"], shell=True)
print("日志文件已清除")
except Exception as e:
print(f"清除日志文件時出錯:{e}")
def clear_windows_update_cache():
try:
# 清除 Windows 更新緩存
subprocess.run(["net", "stop", "wuauserv"], capture_output=True, text=True)
subprocess.run(["rmdir", "/s", "/q", "C:\\Windows\\SoftwareDistribution"], capture_output=True, text=True)
subprocess.run(["net", "start", "wuauserv"], capture_output=True, text=True)
print("Windows 更新緩存已清除")
except Exception as e:
print(f"清除 Windows 更新緩存時出錯:{e}")
if __name__ == "__main__":
clear_temp_files()
clear_browser_cache()
clear_log_files()
clear_windows_update_cache()
鏈接:pan.baidu.com/s/1xQT3Igl7e4AqVad6T-F0fA?pwd=ugx5
提取碼:ugx5