Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I like the Windows-L keyboard shortcut to lock the computer. Are there similar shortcuts for "Log Off" and "Standby"? Is it possible to remap Windows-L to a different function?

share|improve this question
    
They better would not exist, since these are highly destructive actions. –  kinokijuf May 14 at 13:12

10 Answers 10

up vote 17 down vote accepted

With an AutoHotkey script, you can remap the Win+L shortcut and create another one for Sleep (I chose Win+S, normally not used unless you use 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

There is more detail on the DLL call in AutoHotkey's help file:

; 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)
share|improve this answer
    
Note that AutoHotKey_L is now the main development branch. See en.wikipedia.org/wiki/AutoHotkey and l.autohotkey.net –  Ron Klein Oct 9 '12 at 2:13

This tutorial is for Windows Vista, but should work also for Windows 7.

Vista Log Off Shortcut Creation

share|improve this answer

Standby

  • create a new text file and put this on it

rundll32 powrprof.dll,SetSuspendState

  • save it as "standby.bat" and create a shortcut of it on the desktop

  • right-click the shortcut, select propriety and edit its shortcut key to CTRL + ALT + S

now CTRL + ALT + S will put your computer in standby.

Logoff

  • create a new text file and put this on it

logoff

  • save it as "logoff.bat" and create a shortcut of it on the desktop

  • right-click the shortcut, select propriety and edit its shortcut key to CTRL + ALT + L

now CTRL + ALT + L will logoff.

share|improve this answer
1  
Do shortcuts' Shortcut keys actually work now? Unpossible! I gave up trying to use those back in Win95. :) –  JMD Nov 19 '09 at 21:00
6  
You don't really need to create a batch file; you can create a shortcut directly to the logoff executable. –  intuited Feb 28 '11 at 18:02
    
+1 because it is a solution that doesn't involve installing another (albeit flexible) program just to do one thing. –  Richard Jun 24 '13 at 10:58

There is a keyboard solution using existing shortcuts, though not as a single chord (meaning release each key before pressing the next):

  • Win, , Enter - last used shutdown action
  • Win, , - select shutdown action

Found it at http://superuser.com/questions/16327/what-are-your-favourite-less-well-known-keyboard-shortcuts-in-windows

share|improve this answer

The Windows 7 hibernate shortcut key is more like a PlayStation secret function!

⊞ Win, , , then:

  • H - hibernate
  • S - sleep
  • U - shutdown
  • O - lock
  • L - log off

It helps when you have lost your screen on the way! An alternative shortcut to hibernate is:

⊞ Win + D, Alt + F4, H, Enter

share|improve this answer
7  
Though technically "win, ->, ->, s" isn't a real short cut, as you're just navigating to the sleep button via your keyboard :\ –  user170062 Nov 4 '12 at 13:50
    
You're right Bob. They are not short-cuts. My screen blacks out when I connect to the PC remotely, and never comes back. I use a keyborad Sleep button to sleep the PC and then bring it back, and its fine. But if I didn't have that (or the screen is locked), there does not seem to be a key-code to reproduce the same thing. –  Nicholas Apr 9 '13 at 17:05

Under windows7, check out the "shutdown" command from the cmd prompt.

Unfortunately, while it has hibernation as an option, it does not include "sleep"

share|improve this answer
4  
This isnt a keyboard shortcut? –  Simon Sheehan Feb 20 '12 at 15:59

This should really help out: Windows 7 Keyboard Shortcuts / Windows / Keyboard-Shortcut.com

Shutdown is actually WinEnter.

share|improve this answer

create a shortcut .. put the location of the file as logoff.exe and name the shortcut whatever.. done.. right click shortcut go to properties.. change icon and pick an icon image for your shortcut.

and if you want it to be a hotkey.. then right click the shortcut and notice the hotkey box ... click it.. and then press a combination of keys.. bang.. done.. your welcome.

share|improve this answer
1  
This is the same answer as provided by @Revolter: superuser.com/a/72807/23133 –  Ƭᴇcʜιᴇ007 Jun 21 '13 at 16:25

Win + R "shutdown /L", the command line log off which can also be used as shortcut icon with custom user shortcuts.

share|improve this answer

You can use the Alt+F4 shortcut then choose what you want in the resulting dialog box, or you can make one of them your default by doing the following:

  • Click on the start button
  • Right click on the arrow beside the bottom Power Settings button, and choose the Properties in this context menu. It should be the only one.
  • In that dialog box choose Sleep (or whatever default you want) in the Power button Action field, then apply it and click OK.

When you're ready to put your PC to sleep or whatever you chose, use the Alt+F4 keyboard shortcut and then hit Enter. Whatever you set in the first step will be the default action that is applied when you hit Enter.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.