regedit 開啟登錄編輯器。HKEY_CLASSES_ROOT\Directory\shell,新建項目 Restart。Restart 的預設值設為 重新啟動。
Restart 下新建 command 項目,預設值設為:shutdown -r -t 1 -c "1秒後重新啟動"
將下列內容存為 AddEmptyRecycleBin.reg 並雙擊匯入:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\empty]
"CommandStateHandler"="{c9298eef-69dd-4cdd-b153-bdbc38486781}"
"Description"="@shell32.dll,-31332"
"Icon"="shell32.dll,-254"
"MUIVerb"="@shell32.dll,-10564"
[HKEY_CLASSES_ROOT\*\shell\empty\command]
"DelegateExecute"="{48527bb3-e8de-450b-8910-8c4099cb8624}"
[HKEY_CLASSES_ROOT\Folder\shell\empty]
"CommandStateHandler"="{c9298eef-69dd-4cdd-b153-bdbc38486781}"
"Description"="@shell32.dll,-31332"
"Icon"="shell32.dll,-254"
"MUIVerb"="@shell32.dll,-10564"
[HKEY_CLASSES_ROOT\Folder\shell\empty\command]
"DelegateExecute"="{48527bb3-e8de-450b-8910-8c4099cb8624}"

匯入後,右鍵任意檔案/資料夾即可看到「清空回收站」選項,點擊即執行清空動作。
利用 Shell 擴充介面 DelegateExecute 呼叫系統內建的回收站清空命令,無需額外腳本,相容性佳。