Is it possible to register shortcuts on Windows 7 so that regardless where you are looking (Desktop, a folder etc) the shortcut gets "heard" and the appropriate action is performed.

For example, creating a shortcut in the System32 folder which will work if you use Run with the shortcut's name, will not work if you set a key combination when focus is set on the Desktop for example.

Is there a native way of registering top-level shortcuts or even an application for enabling this?

Example of things I want keyboard shortcuts for:

  • open a specific folder like %path%
  • create a new .js file in the current folder
  • launch an application eventually with its path set to the current location if the app supports this (e.g. command prompt)

Thank you.


You could probably do this with AutoHotKey.

For instance, let's say you want the shortcut Win + S to launch MyScript. Install AutoHotKey, copy what follows to the AutoHotkey.ahk file, and restart AutoHotKey:

SetTitleMatchMode RegEx

; Stuff to do when Windows Explorer is open
#IfWinActive ahk_class ExploreWClass|CabinetWClass


; Launches a custom script in the directory browsed in Explorer.
; Note: expecting to be run when the active window is Explorer.
    ; This is required to get the full path of the file from the address bar
    WinGetText, full_path, A

    ; Split on newline (`n)
    StringSplit, word_array, full_path, `n
    ; Take the first element from the array
    full_path = %word_array1%   

    ; strip to bare address
    full_path := RegExReplace(full_path, "^Address: ", "")

    ; Just in case - remove all carriage returns (`r)
    StringReplace, full_path, full_path, `r, , all

    IfInString full_path, \
        Run, C:\Path\To\MyScript "%full_path%"
        Run, C:\Path\To\MyScript "C:\ "

Inspired from those two answers:

  1. https://superuser.com/a/205368/118346
  2. https://stackoverflow.com/a/100648/1005455
  • Thanks for that. I take it there's no simple way to do this, eventually with a GUI? Editing scripts is better than nothing, but I don't want to waste time learning how to do that when a GUI would be so much faster. – Francisc Sep 24 '12 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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