1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Aliases for google searching

Discussion in 'T&T - Aliases' started by Avi Shmidman, Apr 6, 2012.

  1. Avi Shmidman

    Joined:
    Feb 23, 2012
    Messages:
    229
    Likes Received:
    2
    Google-searching is one of the most frequent operations performed on computers these days. I'm wondering what the community here has come up with in terms of useful aliases for quick and efficient google-searching from the command line.
    For now, I'm using this alias:
    alias g http://www.google.com/search?q=^q%%1$^q
    Which lets me type:
    [C:\] g tcc
    This launches a browser window with a google search for "tcc".
    Note that I've included quotes in the alias, so that it will work with multiple search terms as well. That is, one can write:
    [C:\] g how can I search google with tcc
    And then the query will include all of those search terms
    I'm interested in hearing any other idea y'all might have regarding google searching from the command line.
    - Avi
     
    #1
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    2,767
    Likes Received:
    18
    I use a batch file, GOOGLE.BTM. This isn't really mine, or not much of it; I remember it as being a collaboration from an earlier version of the support forum, or maybe even the Usenet group.

    Code:
    @echo off
    rem  Google.btm
     
    if "%1" == "-?" .or. "%1" == "/?" goto syntax
     
    setlocal
    setdos /c254 /e253 /p36
     
    switch "%1"
    case ""
      set url=http://www.google.com
    case "-g" .or. "/g"
      set url=http://groups.google.com/groups?q=%2$
    case "-i" .or. "/i"
      set url=http://images.google.com/images?q=%2$
    case "-m" .or. "/m"
      set url=http://maps.google.com/maps?q=%2$
    case "-n" .or. "/n"
      set url=http://news.google.com/news?q=%2$
    case "-w" .or. "/w"
      set url=http://www.google.com/search?q=%2$
    default
      set url=http://www.google.com/search?q=%$
    endswitch
     
    set url=%@replace[+,::2B,%url]
    set url=%@replace[%=s,+,%url]
    set url=%@replace[%=q,::22,%url]
    set url=%@replace[::,`%%`,%url]
    start %url
     
    endlocal
    quit
     
     
    :syntax
     
    echo.
    echo %@upper[%@filename[%_batchname]]:  Search using Google
    echo.
    echo Usage:  %@upper[%@name[%_batchname]] `[-G|-I|-M|-N|-W] search terms`
    echo.
    echo      -G  groups (Usenet)
    echo      -I  images
    echo      -M  maps
    echo      -N  news
    echo      -W  web (default)
    echo.
    quit
     
    
     
    #2
  3. Avi Shmidman

    Joined:
    Feb 23, 2012
    Messages:
    229
    Likes Received:
    2
    Nice! Thanks for posting!
    I think it would be also be useful to add switches for some of google's advanced search options, too, e.g. to limit search results by date or by domain. I'll experiment a bit with the batch file to see what I can do.
    Thanks!

     
    #3
  4. epement

    Joined:
    Jun 28, 2008
    Messages:
    63
    Likes Received:
    2
    Charles, thanks for posting the the batch file, "google.btm". Really nice!
     
    #4

Share This Page