有辦法把 PC 機殼上的電源鍵對應到程式嗎 - Windows

Table of Contents

作業系統:

Service Pack:20H2

發生問題頻率:100%

是否有做Windows Update:yes

問題內容:


目前 PC 電源鍵 default 是對應到 shutdown.exe -s -t 0
但是有的程式會卡住無法自動關閉,如果遇到卡住有可能關機未完成。
如果我要寫一個 batch

for %%i in ( kmplayer.exe acdsee.exe winword.exe excel.exe) do taskkill /f /im "%%~i"
shutdown -t 0 -s -f

這樣的 Batch 有辦法把他串到電源鍵的關機動作嗎?

--

有錢郎~講話大聲~~萬事攏佔贏~~~~冇錢郎踮在世間~講話冇郎聽~
歹命郎~著愛打拼~不好乎人驚~啊~~~啊~啊~啊~啊~
世間ㄟ~~~~
世間ㄟ歹命郎為錢賭性命~~為~錢~賭~性~~~~命~~


--

All Comments

Leila avatarLeila2021-09-09
https://stackoverflow.com/questions/12434863/execu
ting-a-batch-script-on-windows-shutdown
簡單來說就是login/shutdown可以trigger你要的指令