Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to re-purpose some keys that I never use into functions I use all the time. I discovered AutoHotkey here on SuperUser and figured this would be the way to go, but I'm having difficulties already.

The first thing I wanted to do is to remap the Scroll Lock key so that it locks my computer (like pressing Win+L does). From what I have gathered in the AutoHotkey help file, this should work


but it doesn't do anything.

If I change the script to read SCROLLLOCK::Send #e then the Scroll Lock key does launch Windows Explorer, as would be expected. Does anyone know how to lock the computer from AutoHotkey?

Update - I tried the following code as well, but to no avail:

SCROLLLOCK::Run C:Windows\System32\rundll32.exe user32.dll,LockWorkStation

The command does lock the computer if you just dump it in the run command, but in AutoHotkey it just does a really brief flash of the "waiting" cursor, then nothing.

share|improve this question
You also appear to be missing a backslash in your run command - C:Windows => C:\Windows... – Bob Jul 25 '12 at 0:30
up vote 1 down vote accepted

You can lock the computer with AutoHotkey's Run command:

ScrollLock::Run, % "rundll32.exe user32.dll,LockWorkStation"

You have to be careful when passing parameters, so I like to use an expression to encode the entire command properly.

share|improve this answer

Your Answer


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.