Saturday, August 10, 2019

keyboard shortcuts - How to remap a single specific Key to a Windows Shorcut?



My keyboard does not have a "Sleep" Key to put my PC to sleep, so I created a Windows Shorcut to put my PC to sleep.



Now I want to map a single specific Key to that Shortcut, but all Windows Shortcuts start with "Ctr + Alt", which makes any Windows Shorcut require a minimum of 3 Key presses.



So I would like to map a specific single Key to my "Sleep" Shorcut so that I can put my PC to sleep by simply pressing that single Key. I have never in my life used the "Pause/Break" Key on my keyboard, so that would be a perfect candidate.



How can I remap the "Pause/Break" Key to the "Sleep" Shorcut I created?




(Alternatively, is there another way to put my PC to sleep using a single Key on a keyboard that does not have a "Sleep" Key?)


Answer



This is easily accomplished with AutoHotKey.




AutoHotkey is a free, open-source macro-creation and automation software utility that allows users to automate repetitive tasks in Microsoft Windows. Any application user interface can be modified by AutoHotkey (for example, overriding the default Windows control key commands with their Emacs equivalents). It is driven by a custom scripting language that is aimed specifically at providing keyboard shortcuts or hotkeys.




The script would be:





pause::run "full path of your shortcut"




Obviously, put the path to your shortcut in the quotes.



There are other methods to sleep, shutdown, hibernate, or restart your PC. You can find the commands here. Read through the comments though on the selected answer, there are some caveats that can be worked around.



Personally, I love AutoHotKey. I remap the media keys on my keyboard (I never use them for media) to do things like open a command prompt, start a remote desktop session, open Notepad++, start the snipping tool, etc.



No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...