[問題] 有辦法把 PC 機殼上的電源鍵對應到程式嗎

作者: loser1 (拍嘎爪得白醬)   2021-09-07 17:39:30
作業系統:
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 有辦法把他串到電源鍵的關機動作嗎?
作者: tomsawyer (安安)   2021-09-08 11:56:00
https://stackoverflow.com/questions/12434863/executing-a-batch-script-on-windows-shutdown簡單來說就是login/shutdown可以trigger你要的指令

Links booklink

Contact Us: admin [ a t ] ucptt.com