WSH (Windows Scripting Host):獨立於語言的腳本執行環境(wscript.exe/cscript.exe),Win98 內建,Win95/NT 需安裝。呼叫 IE 的 VBScript/JScript 引擎解析腳本。
' 1. 建立 Shell 物件
Set RegWsh = WScript.CreateObject("WScript.Shell")
' 2. 讀取鍵值
value = RegWsh.RegRead("HKCU\MyRegKey\")
' 3. 建立/修改鍵值
RegWsh.RegWrite "HKCU\MyRegKey\", "值", "REG_SZ"
' 4. 刪除鍵值
RegWsh.RegDelete "HKCU\MyRegKey\"
根鍵\主鍵路徑\鍵值
\ 分隔\ 結尾表示操作整個主鍵HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableRegistryTools 禁用 RegeditHKCU\Software\Microsoft\Internet Explorer\Main\Start PageHKLM\Software\Microsoft\Windows\CurrentVersion\Run' 解除 Regedit 封鎖
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegDelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableRegistryTools"
WshShell.RegDelete "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableRegistryTools"
' 恢復 IE 首頁
WshShell.RegWrite "HKCU\Software\Microsoft\Internet Explorer\Main\Start Page", "about:blank", "REG_SZ"
腳本門檻低、威力大、難防範。理解 WSH/VBScript 操作註冊表機制,才能從根本識別並中和惡意代碼。