Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Aliases for google searching

Feb
240
3
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
 
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
 
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!

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
 
Back
Top