DEV Community

Cover image for Windows restore system environment variables
FakeStandard
FakeStandard

Posted on

Windows restore system environment variables

Windows System 內建許多系統環境變數,一般在安裝軟體時,有時候會需要手動將軟體安裝位置的根目錄加入到 Environment Variable 裡,前一篇介紹了如何增刪修環境變數,這篇主要介紹萬一手殘不小心刪掉變數該怎麼還原?

由於圖形介面沒有一個快速還原的按鈕,必須使用其他的方法來還原它

打開登錄編輯程式(regedit)

win-001

找到路徑 HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Control > Session Manager > Environment

win-002

在右邊視窗的名稱欄位找到要還原的變數名稱,我的狀況是要找 Path 變數,故以此為例,資料欄位是變數的內容,該內容就是之前被刪除的變數值,將此內容複製,再依照上一篇的作法將變數添加回去就完成了!

該方法有一個限制,必須在修改後的設定值還沒寫回去才可使用


Thanks for reading the article 🌷 🌻 🌼

If you like it, please don't hesitate to click heart button ❤️
or follow my GitHub
or buy me a coffee ⬇️ I'd appreciate it.

Buy-me-a-coffee


Top comments (0)