Microsoft

Customize the [Windows]+E key shortcut to open what you want

Greg Shultz shows you how to use AutoHotkey in Vista to re-route the [Windows]+E so that Windows Explorer opens a folder of your choice. He also provides you with a list of all of the standard [Windows] key shortcuts.

I've recently received several requests from TechRepublic members wanting to reprogram or customize the [Windows] key. More specifically, people have asked me if there was a way to reprogram the [Windows]+E key shortcut such that, instead of launching Windows Explorer targeted on the Computer folder, [Windows]+E could be used to launch Windows Explorer targeted on the folder of your choice. For example, you might want the [Windows]+E key shortcut to open Documents. Fortunately, I've discovered a way to accomplish this task by using a free utility called AutoHotkey.

In this edition of the Windows Vista and Windows 7 Report, I'll show you how to use AutoHotkey in Vista to reroute the [Windows]+E so that Windows Explorer opens a folder of your choice. As I do, I'll provide you with a list of all the standard [Windows] key shortcuts.

This blog post is also available in PDF format in a free TechRepublic download.

The standard [Windows] key shortcuts

Before I show you how to use AutoHotkey to reroute the [Windows]+E, let's take a look at the default [Windows] key shortcuts in Vista (see Table A). Of course, pressing the [Windows] key by itself opens and closes the Start menu. More Windows shortcuts are available in this TechRepublic download.

Table A

[Windows] +

Action/Description

1-9 & 0 Launches applications on the Quick Launch toolbar. You can have up to 10 shortcuts on the Quick Launch toolbar to use with the [Windows] key. The first shortcut on the Quick Launch toolbar is automatically assigned to [Windows]+1, the second shortcut to [Windows]+2, and so on. The tenth shortcut is automatically assigned to [Windows]+0
B Selects the first icon in the Notification Area. If you have the Hide Inactive Icons setting enabled, the Show/Hide toggle arrow will be selected. You can then use the right and left arrow keys to select whatever icon you want.
D Shows the desktop. This will minimize all open windows so you can see the desktop.
E Launches Windows Explorer targeted on the Computer folder.
F Launches the Search tool.
[Ctrl]+F Launches the Find Computers tool.
G Switch between gadgets on the Windows Sidebar.
L Locks the system.
M Minimizes all open windows.
[Shift]+M Restores all minimized windows.
R Launches the Run dialog box.
U Launches the Ease of Access Center.
T Cycles through programs using the Live Taskbar feature.
[Break] Launches the System window.
[F1] Launches Windows Help and Support.
[Spacebar] Brings the Windows Sidebar to the foreground.
[Tab] Launches the Flip 3D task switcher.

Using AutoHotkey

AutoHotkey is a FREE program that allows you to create customized macros that can perform all sorts of operations. Keep in mind that AutoHotKey has much more potential than simply rerouting the [Windows]+E, but for now, I'll only show you how to use the utility to perform this relatively simple operation. You can learn more about AutoHotKey's extensive list of features in its Help system and on the Documentation page of the AutoHotKey Web site.

Once you download the installation program, installing AutoHotkey is a snap. You just follow the steps presented by the setup wizard and respond with the appropriate action in the User Account Control dialog box.

AutoHotkey doesn't really have a user interface, so to speak. Rather, you create short scripts in Notepad that contain a hotkey definition and an action that you want to perform. Once you create a script, you double-click it to load the AutoHotkey application and the script into memory. AutoHotkey then runs in the background and waits for you to press the assigned hotkey. When you do, it launches the associated action.

AutoHotkey allows you to use any keystroke combination as its hotkey — even keystroke combinations that are already assigned by other programs. Therefore, AutoHotkey allows you to override existing keystroke combinations.

One of the keys that AutoHotkey will allow you to customize is the [Windows] key. You can essentially reprogram the [Windows]+E key to open any folder that you wish. Let's take a closer look at how you will accomplish this.

Once you install AutoHotkey, it adds an item to the New menu called AutoHotkey Script. Choose a folder where you want to create your scripts and then right-click and select the New | AutoHotkey Script command, as shown in Figure A. When the new script appears, the default filename is highlighted so you can easily rename it. As you do, be sure not to change the file extension from .ahk.

Figure A

To create a script, just right-click inside a folder and select the New | AutoHotkey Script command.

To continue, right-click on the file and select the Edit Script command. When Notepad opens the file, you'll see the contents of the default template. In the template, the lines that begin with a semicolon (;) are comment lines and can be deleted if you wish. The other lines in the template are used to customize the environment for the script and should be left as they are.

To reprogram the [Windows]+E key to open any folder that you wish, use the following command line:

#e:: Run explorer.exe {FolderPath}
Where {FolderPath} is the path to the folder that you want to open when you press the [Windows]+E key. For example, to configure the [Windows]+E key to open my Documents folder, my script contained the command line listed below and shown in Figure B. That's all there is to it!
#e:: Run explorer.exe C:\Users\Greg Shultz\Documents

Figure B

To reprogram the [Windows]+E key to open my Documents folder, I used this simple command along with the path to the Documents folder.
Once you have created your script, double-click it to load the application and the script into memory. You'll then see the AutoHotkey icon appear in the Notification Area, as shown in Figure C. This indicates that your hotkey script is ready and waiting for you to press the [Windows]+E key.

Figure C

You can use this simple command line to reprogram the [Windows]+E key.

To configure your script to run every time you launch Windows, create a shortcut to the script and copy it to the Startup folder. Now, whenever you press the [Windows]+E key, Windows Explorer opens the folder that you specified in your script.

Other Windows versions

In addition to using this technique in Vista, I also tested it in Windows XP and it works fine. However, keep in mind that AutoHotKey does not officially mention support for Windows 7, and I have not verified that AutoHotkey will work reliably in Windows 7.

What's your take?

Do you use the [Windows] key shortcuts? Have you wanted to reprogram the [Windows]+E so that it could be used to launch Windows Explorer targeted on the folder of your choice? Will you use this technique to reprogram the [Windows]+E key?

TechRepublic's Windows Vista and Windows 7 Report newsletter, delivered every Friday, offers tips, news, and scuttlebutt on Vista and Windows 7, including a look at new features in the latest version of the Windows OS. Automatically sign up today!

About

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

Editor's Picks