蝙蝠文件,自动注销我的电脑

时间:2016-03-11 07:48:57

标签: batch-file

我想恶作剧,我需要一些帮助。

我需要一个.bat脚本,它会在我的电脑上按下键盘上的任何按钮后注销我的电脑。

有人可以帮助我吗? :)

1 个答案:

答案 0 :(得分:0)

使用AutoHotkey脚本,您可以重新映射 Win + L 快捷方式并为Sleep创建另一个(我选择 Win + S ,除非您使用OneNote,否则通常不会使用):

#l::         ; Win+L
Shutdown, 0  ; this is the code for Log Off
return

#s::         ; Win+S
DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0) ; DLL call to sleep
return

有关AutoHotkey帮助文件中DLL调用的更多详细信息:

; Call the Windows API function "SetSuspendState" to have the system suspend or hibernate.
; Windows 95/NT4: Since this function does not exist, the following call would have no effect.
; Parameter #1: Pass 1 instead of 0 to hibernate rather than suspend.
; Parameter #2: Pass 1 instead of 0 to suspend immediately rather than asking each application for permission.
; Parameter #3: Pass 1 instead of 0 to disable all wake events.
DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)

请参阅https://superuser.com/questions/72789/are-there-windows-7-keyboard-shortcuts-for-log-off-and-standby