Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to be able to quickly start a Google search from my desktop (Win XP), whether or not I have a browser open. Something along the lines of WinG, then I can simply start typing my search term and hit Enter.

Does such a solution exist?

share|improve this question
up vote 4 down vote accepted

AutoHotKey will allow you to set up a custom script to open your browser and navigate to a desired page in one shot. For example, the script to launch Firefox and go to Google using Win + G is as simple as this:

run % "C:\Program Files\Mozilla Firefox\firefox.exe" 
share|improve this answer

I use the following AutoHotKey script to search a word or phrase I've selected just about anywhere, for example in my browser, word-processor, help file, or IDE. That isn't exactly what you asked for, but I thought it might be useful anyway. Come to think of it, it probably could be modified to prompt for search term(s) when none are selected...

#SingleInstance force ; skip the dialog box and replace the old instance
#NoEnv ; avoid checking empty variables to see if they are environment variables

; ---------------------------------------------------------------------
; Search Google for currently selected text (in any application)
#g:: ; winkey+g
SaveClip := ClipboardAll
Send ^c
; Clean up clipboard contents
; note: call written as assignment because ByRef parm passing doesn't
; work on built-in Clipboard variable
Clipboard := CleanString(Clipboard)

Clipboard := urlEncode(Clipboard)

; Search Google for the exact phrase
; restore clipboard
Clipboard := SaveClip
SaveClip =

    ; Convert control characters 00-1F hex (0-31 decimal) and 7F (127 decimal) to spaces.
    loop, 32
        StringReplace, str, str, % Chr(A_Index-1), %A_Space%, All
    ; Collapse all runs of spaces to a single space
        StringReplace, str, str, %A_Space%%A_Space%, %A_Space%, UseErrorLevel
        if ErrorLevel = 0 ; No more replacements needed.

    str = %str% ; remove leading and trailing spaces and tabs (assumes AutoTrim is on)

    return, str
share|improve this answer

Here is a possible solution. I have made a script in AutoHotKey.

share|improve this answer

It's not difficult. All you really need is a way of opening a URL and a simple script to generate the URL you need, munging any special characters in the query, filling in the domain and the rest of what Google expects.

Here's very minimal (call it "proof of concept") example I just did with my C shell. The only special characters it treats are spaces, which it turns into + signs as expected by Google.

proc google( terms )
   set terms = "$terms:gS/ /+/"
   open "$terms&gbv=1&oq=$terms"

Having defined this procedure, if I type google hamilton laboratories, I get this opening in a new tab in my default browser, which happens to be Chrome.

To do the same thing under cmd.exe, you'd probably use the start command to open the URL. I'm not an expert in cmd.exe, so I leave it to others to edit this answer to fill in the rest of a cmd.exe sample script with the preferred way to do the string manipulation.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .