A very simple Win+R enhancement

I use the Win+R combination to run almost all the applications I use. Hit Win+R, type firefox, and Firefox runs. Hit Win+R, type winword, and Word starts. Hit Win+R…, well you get the idea.

The Run dialog is great to quickly access applications you use, but it’s only usable for programs that put their folder in the PATH environment variable, which not all programs do. I’ve been adding programs I liked to the PATH for years when a friend of mine showed me a neat trick. You create a folder called Shortcuts somewhere (say C:\Shortcuts) and put it at the start of your PATH environment variable and then create shortcuts to your favorite programs in that folder. All those shortcuts are now available to you via using Win+R. A nice bonus is the fact that you can name the shortcuts any way you like. I usually have a www.lnk file pointing to Firefox, note.lnk pointing to Notepad and word.lnk pointing to Word.

There’s only one thing missing here to make this trick into an fully featured program launcher. We need a way to quickly create shortcuts to programs, preferably by right-clicking on them in Windows Explorer. You can do that without installing anything using a couple of obscure Windows features – the Send To menu in the right-click menu of each file and the fact that Windows can run *.vbs files with VBScript code in it using something called WSH.

Here’s the source of a script that creates a link to whichever was passed to it in the command line (executable, folder, etc.).

SHORTCUTS_PATH = "C:\Shortcuts"

If WScript.Arguments.Count < 1 Then
    WScript.Echo("Missing parameters")
Else
    ‘ create shorcut name
    commandPath = WScript.Arguments(0)
    dot = InStrRev(commandPath, ".")
    If dot = 0 Then dot = Len(commandPath)
    slash = InStrRev(commandPath, "\")
    If slash = 0 Then slash = 1
    commandDir = Mid(commandPath, 1, slash-1)
    shortcutName = Mid(commandPath, slash+1, dot-slash-1)

    ‘ ask for shortcut name
    shortcutName = InputBox("Enter shortcut name", "Shortcut", shortcutName)

    ‘ create shortcut
    shortcutPath = SHORTCUTS_PATH & "\" & shortcutName & ".lnk"
    Set WshShell = WScript.CreateObject("WScript.Shell")
    Set oShellLink = WshShell.CreateShortcut(shortcutPath)
    oShellLink.TargetPath = commandPath
    oShellLink.WindowStyle = 1
    oShellLink.IconLocation = commandPath & ", 0"
    oShellLink.WorkingDirectory = commandDir
    oShellLink.Save
End If

The Send To menu is actually a folder located at C:\Documents and Settings\<YourUser>\SendTo. This folder contains links to various programs and you can add shortcuts to your own programs there. When you right-click a file, and choose one of the Send To items, the corresponding program is called, and given the name of the file you right-clicked as a command line parameter. So, if you put a link to the script above in the Send To folder, you’ll be able to easily create links in the C:\Shortcuts folder.

In case you lost me somewhere along the way, and in case I ever need to set this up myself again, here are the instructions to set things up:

  1. Create C:\Shortcuts
  2. Create C:\Shortcuts\create_shortcut.vbs and paste the above code into it.
  3. Add C:\Shortcuts to the start of your PATH environment variable (Win+Pause > Advanced > Environment Variables).
  4. Hit Win+R, type sendto, hit Enter. That should get you to your Send To folder.
  5. Create a shortcut here to C:\Shortcuts\create_shortcut.vbs and call it Shortcuts.

To add a program to the launcher:

  1. Right click a program or a folder (you can do it even on programs in your Start Menu).
  2. Send To > Shortcuts.
  3. In the dialog change the shortcut name to something short and catchy.
  4. Test it : Hit Win+R, type the shortcut name and hit Enter.

5 Comments on “A very simple Win+R enhancement”


By Kevin Watters. January 7th, 2008 at 20:23

I too was a Win+R addict.

That is, until I discovered Launchy:

http://www.launchy.net/

..which is essential on any Windows install, IMO. It even beats the Vista Start Menu’s new search functionality.

By gooli. January 7th, 2008 at 21:51

Launchy is indeed quite cool.
Thanks for the tip!

By siew kam onn. January 8th, 2008 at 03:36

I am a Launchy fan and I echo Kevin Watter’s sentiments.

Launchy will auto-discover all your applications for you if you tell it where to look.

By Eli Bendersky. April 19th, 2008 at 14:42

You should really give AutoHotKey a try. It can do what you want here, and much, much more:

http://www.autohotkey.com/

By kobi h.. October 1st, 2008 at 01:35

I just read this and on my vista hebrew (!) machine found that the “send to” folder hides in
c:\users\%username%\AppData\Roaming\Microsoft\Windows\SendTo .

I Did that by finding the path using the regedit tool and searching the HKCU for the phrase “sendto”