Access a folder

with AutoHotkey

by Denis Lamarre
last updated February 16, 2024
difficulty.png easy


Do you often use Windows Explorer to open folders? Perhaps it’s a folder for this year's Excel spreadsheets or a folder that contains downloads. Desktop shortcuts can be used to access popular folders, but doing so means having to minimize all of your open windows, locating the shortcut, clicking the shortcut icon, and then reopening all of your active windows again. If you find yourself doing this often, the Enterpad/AHK combo will be a time-saver.

With this simple AutoHotkey script, the folder will open in front of all of your open windows, without you having to minimize them, locate the desktop shortcut, or search for the actual folder.



stencil-v4-folder.gifPrepare your overlay
Choose an unassigned key on the Enterpad where you will assign the folder shortcut. Name it something appropriate, like the folder name.


Code installation
Copy and paste the script below in your AutoHotkey script template (Enterpad.ahk) at the location of the key you wish to assign. Replace the path in the code (C:\Users\John Doe\Documents\ThisYear) with the path of your folder. To get the path, you can open the folder in Windows Explorer and then copy it from the address bar at the top.

  run Explorer "C:\Users\John Doe\Documents\ThisYear"

More Info

Special characters

Spaces in the path name won’t cause a problem. However, should your path contain AutoHotkey characters with special meaning, such as ( ` ), ( % ), ( , ), or ( ; ), you will need to prefix them with a backtick ( ` ). For example, if ( % ) appears in the path name, you will need to add a backtick before it, like this ( `% ).

To make things easier, you may want to use the following script (and maybe save it as a key on your Enterpad) to automatically add backticks before any special characters in a path name that has been copied to your Windows clipboard. It will also insert the converted path name in your AHK script (wherever your cursor happens to be):

AhkFriendlyPath := RegExReplace(Clipboard, "(``|`%|`,|`;)", "``$1")
  SendInput {raw}%AhkFriendlyPath%


The "Access a folder" script runs File Explorer with its default options. You can set useful options after "Explorer" on the same line of code. The following example starts File Explorer with the "ThisYear" folder selected:

run Explorer /select`,"c:\users\John Doe\Documents\ThisYear"

You can find out more about Windows Explorer options at

Environment variables

Some AutoHotkey environment variables can be useful for defining the path name. The following example opens the current user's "My Documents\ThisYear" folder:

run Explorer "%A_MyDocuments%\ThisYear"

You can find all the AutoHotkey environment variables at