Use the cmd command to search for a word on Google or another search engine

I am trying to use a programming language to search google or another specified search engine. I would like to use the Windows cmd prompt for this because the specified programming language has a simple command to access the cmd prompt.

Any ideas on google searching from cmd command line?

+5
source share
8 answers

Just type this on the command line or in the start command, and it will open the default browser to allow Google to search SEARCHTERM:

start www.google.com/search?q=SEARCHTERM

Note that you need to replace spaces with pluses, for example.

start www.google.com/search?q=Use+cmd+prompt+to+search+a+word+on+google+or+other+search+engine

:

@start www.google.com/search?q=%1+%2+%3+%4+%5+%6+%7+%8+%9
+3

g.bat PATH. :

start www.google.co.uk/search?q=%1+%2+%3+%4+%5

5 (, ). CMD "g query"

:

+1

ps1:

function googleSearch{start www.google.com/search?q=$args}
set-alias g googleSearch

PowerShell,

g whatwhatwhat
+1

, wget .

wget -U "Firefox/3.0.15" http://www.google.com/search?q=SEARCH+TERMS+HERE -O result.html -q

-O- -q . html .

wget, grep GnuWin32, . :

wget -U "Firefox/3.0.15" "http://www.google.com/search?q=wget+google+search" -O- -q 2>&1 | grep -E -o -e "<cite>[^<]+</cite>" | sed -r -e "s/<[^>]+>//g"

... URL- Google. . .

( : isaksen.biz/blog/?p=470)

URL-, .

@echo off
setlocal enabledelayedexpansion
set search=%1 %2 %3 %4 %5 %6 %7 %8 %9
for /l %%a in (1,1,8) do if "!search:~-1!"==" " set search=!search:~0,-1!
set search=%search: =+%
wget -U "Firefox/3.0.15" "http://www.google.com/search?q=%search%" -O search.html -q 2>NUL
for /f "tokens=*" %%I in ('grep -P -o "<h3 class=.*?</h3>" search.html ^| sed -r -e "s/<[^>]+>//g"') do (
    echo %%I
    goto next
)
:next
set /p I="http://"<NUL
for /f "tokens=*" %%I in ('grep -E -o -e "<cite>[^<]+</cite>" search.html ^| sed -r -e "s/<[^>]+>//g"') do (
    echo %%I
    del /q search.html
    goto :EOF
)

: search.bat up to 9 search terms here

:

C:\Users\me\Desktop>search command line google
googlecl - Command line tools for the Google Data APIs - Google ...
http://goosh.org/

C:\Users\me\Desktop>
0

.

@echo off
color a
setlocal ENABLEDELAYEDEXPANSION
echo Google Batch
echo Made By GenoSans
start https://discord.gg/WwRtbBe
timeout -t 5 /nobreak
:a
cls
echo                                            ,,
echo   .g8'''bgd                               `7MM
echo .dP'     `M                                 MM
echo dM'       `   ,pW'Wq.   ,pW'Wq.   .P'Ybmmm  MM  .gP'Ya
echo MM           6W'   `Wb 6W'   `Wb :MI  I8    MM ,M'   Yb
echo MM.    `7MMF'8M     M8 8M     M8  WmmmP'    MM 8M''''''
echo `Mb.     MM  YA.   ,A9 YA.   ,A9 8M         MM YM.    ,
echo   `'bmmmdPY   `Ybmd9'   `Ybmd9'   YMMMMMb .JMML.`Mbmmd'
echo                                  6'     dP
echo                                   Ybmmmd'
echo.
set /p s=Search: 
set word=+
set str=%s%
set str=%str: =!word!%
start http://www.google.com/search?q=%str%
goto a
0

u java, ...

//Java- // cmd

class NewClass
{
    public static void main(String[] args)
    {
        try
        { 

         Runtime.getRuntime().exec("cmd /c start cmd.exe /K \"start www.google.com/search?q=**search here instead of space use '+'**\"");
        }
        catch (Exception e)
        {
            System.out.println("HEY Buddy ! U r Doing Something Wrong ");
            e.printStackTrace();
        }
    }
}

, ! .

0
  • ""
  • type start www.google.com/
  • .bat
  • , Google
  • cmd
-1

, ?

@echo off
:start
cls
echo.
echo G O O G L E Web Search Version 1.1
echo.
echo Type search terms, and your internet browser will open it.
echo.
set /p Web=
start www.google.com/search?q=%Web%
goto start

.bat !

-1

All Articles