-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgoogle.bat
37 lines (28 loc) · 845 Bytes
/
google.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
@echo off
rem @author Howard Edwards
rem google.bat ~ Using Google's search engine to perform a web search or to open a web address directly
rem Usage: google <query>
rem Usage: cmd //c google <query> (with default Git Bash installation options on Windows)
if not "%1"=="" (set QUERY=%1) else (goto error)
if not %QUERY:.com=% == %QUERY% (goto url) else (goto org)
:org
if not %QUERY:.org=% == %QUERY% (goto url) else (goto net)
:net
if not %QUERY:.net=% == %QUERY% (goto url) else (goto gov)
:gov
if not %QUERY:.gov=% == %QUERY% (goto url) else (goto edu)
:edu
if not %QUERY:.edu=% == %QUERY% (goto url) else (goto loop)
:url
start http://%QUERY%
exit
:loop
shift
if not "%1"=="" (set QUERY=%QUERY%+%1) else (goto exitloop)
goto loop
:exitloop
start http://www.google.com/search?q=%QUERY%
exit
:error
echo "Usage:: google <query>"
exit