➤ 告別 WSL 磁碟空間焦慮:手動壓縮與 PowerShell 自動化實踐指南
✤ https://www.freecodecamp.org/news/how-to-free-up-and-automatically-manage-disk-space-for-wsl-on-windows-1011/
本文提供詳細步驟,指導使用者如何手動釋放 Windows Subsystem for Linux (WSL) 的磁碟空間,並進一步透過 PowerShell 腳本自動化此過程。WSL 的虛擬硬碟 (VHDX) 不會自動清理未使用空間,導致磁碟空間持續縮減。文章涵蓋了驗證 WSL 版本、定位 VHDX 檔案、關閉 WSL 實例,並使用 DiskPart 工具手動壓縮 VHDX。最後,文章介紹如何編寫 PowerShell 腳本,實現自動化檢測 WSL 發行版、尋找 VHDX 檔案,並執行壓
#WSL #Windows #磁碟管理 #PowerShell #DiskPart #腳本自動化
How to Free Up and Automatically Manage Disk Space for WSL on Windows 10/11
Windows Subsystem for Linux (WSL) lets you run a Linux environment directly on Windows. This is particularly useful for web development where you can develop and test applications in a Linux environment without leaving Windows. You can even run freeC...


