2008-06-10

Helpful shortcuts to the Windows' Start Run dialog

I use a lot of Start menu's Run-command by pressing the Windows Key + R. It is quite convinient to type "iexplore" to open up a new browser (or "firefox", if you prefer). However, making Google searches this way is a little bit too awkward when you have to type in "iexplore http://www.google.com/search?q=SEARCH+TERM+HERE".



In order to make internet searches more convenient, I've created a set of small VBS scripts, and placed them into the "C:\Program Files\Internet Explorer" directory.



The files are "g.vbs", "img.vbs" and "mov.vbs" for making Google searches (g.vbs), Google image searches (img.vbs) and IMDB searches (mov.vbs). All of the files are almost identical, containing a short piece of script code as shown here:



I haven't really optimized the code because it is only a short helper script. It combines all of the provided command line arguments into a single string and then passes it onto "iexplore.exe". The arguments are prefixed with a string such as "http://www.google.com/search?q=". The mentioned prefix is from "g.vbs", which results in a Google search with the provided command line arguments. Below is an example of making a Google search directly from the Command Prompt.



In order to integrate these shortcuts into Windows' Start-menu's Run-command, I needed to modify the registry. So, I opened up the registry editor at "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths" and added a new key for each of the VBS-scripts. Please note that the new keys need to be created with a file extension of ".exe" instead of ".vbs". The value of "(Default)" needs to be changed to the full path of VBS-file which is to be run. In other words, the registry key "g.exe" will point to "g.vbs" file. Value of "Path" needs to point to the directory that contains the script file.



After the registry change was done, I was able to launch a Google search straight from the Run-box. In the example below, I am making a search for images by using the "img.vbs" file.



The results from this image search will conveniently open up in a new browser, as shown below.



This method of customizing the Run-command can be extended to many more uses besides Google search. I've created helper commands for MSDN searches, Wikipedia searches, Discogs, etc, etc. The VBScript code example shown in this posting can be performance-tuned, but since it is currently working just fine, I haven't really seen the need to mess around with it any further.

This blog posting was inspired by Wes' Puzzling Blog: Customizing Windows Run Command.

1 comment:

Arttu said...

Moi,

tulit tästä kirjasta sä heti mieleen: http://www.theonering.net/torwp/2008/06/09/28988-john-howe-forging-dragons/