Getting a batch file to search Google
Moderator: DosItHelp
Getting a batch file to search Google
Hi all
I am a photocopier engineer and when I have a strange ongoing problem with a machine I search a website using google site search like this for example.,
blank copies site:http://www.copytechnet.com/forums/canon/
Is there a way to get a batch file to do the search for me so I can start the file, enter my search details and the file adds 'site:http://www.copytechnet.com/forums/canon/' to the end.
Many thanks.
I am a photocopier engineer and when I have a strange ongoing problem with a machine I search a website using google site search like this for example.,
blank copies site:http://www.copytechnet.com/forums/canon/
Is there a way to get a batch file to do the search for me so I can start the file, enter my search details and the file adds 'site:http://www.copytechnet.com/forums/canon/' to the end.
Many thanks.
-
- Posts: 104
- Joined: 28 Jul 2011 17:32
Re: Getting a batch file to search Google
What browser do you want to use?
-
- Posts: 104
- Joined: 28 Jul 2011 17:32
Re: Getting a batch file to search Google
if it is firefox, here is the code:
I'm not in the mood to write something that would replace spaces with pluses so you just need to put a + in the place of spaces..
Code: Select all
@echo off
echo Type what you want to search in google.
echo Put + where you put the spaces. Ex:
echo -
echo You want to search.
echo Would be:
echo you+want+to+search
set /p search=
cd "C:\Program Files\Mozilla Firefox"
firefox http://www.google.pt/search?q=%search%
I'm not in the mood to write something that would replace spaces with pluses so you just need to put a + in the place of spaces..
Re: Getting a batch file to search Google
I use Firefox but can adapt the file for IE which I use at work.
My main reason for this is so I don't have to type the following into Google
site:http://www.copytechnet.com/forums/canon/
I want the script to do that for me I want it to open Google like this
I have tried
[snip]
cd "C:\Program Files\Mozilla Firefox"
firefox http://www.google.pt/search?q=%search% site:http://www.copytechnet.com/forums/canon/
but that doesn't work
My main reason for this is so I don't have to type the following into Google
site:http://www.copytechnet.com/forums/canon/
I want the script to do that for me I want it to open Google like this
I have tried
[snip]
cd "C:\Program Files\Mozilla Firefox"
firefox http://www.google.pt/search?q=%search% site:http://www.copytechnet.com/forums/canon/
but that doesn't work
-
- Posts: 104
- Joined: 28 Jul 2011 17:32
Re: Getting a batch file to search Google
No, what you need to do is :
You can't use spaces.
Use + google will read them as spaces..
For the internet explorer:
Do you want me to create a batch file that you can choose between internet explorer and firefox?
Code: Select all
firefox http://www.google.pt/search?q=%search%[b]+[/b]site:http://www.copytechnet.com/forums/canon/
You can't use spaces.
Use + google will read them as spaces..
For the internet explorer:
Code: Select all
cd C:\Program Files\Internet Explorer
iexplore http://www.google.pt/search?q=%search%+site:http://www.copytechnet.com/forums/canon/
Do you want me to create a batch file that you can choose between internet explorer and firefox?
Re: Getting a batch file to search Google
You could also replace the spaces automatically and you could use the default browser:
Regards
aGerman
Code: Select all
@echo off
set "google=http://www.google.com/search?q="
set "site=+site:http%%3A%%2F%%2Fwww.copytechnet.com%%2Fforums%%2Fcanon%%2F"
set /p "string=Search Details: "
set "string=%string: =+%"
start "" %google%%string%%site%
Regards
aGerman
-
- Posts: 104
- Joined: 28 Jul 2011 17:32
Re: Getting a batch file to search Google
aGerman wrote:You could also replace the spaces automatically and you could use the default browser:Code: Select all
@echo off
set "google=http://www.google.com/search?q="
set "site=+site:http%%3A%%2F%%2Fwww.copytechnet.com%%2Fforums%%2Fcanon%%2F"
set /p "string=Search Details: "
set "string=%string: =+%"
start "" %google%%string%%site%
Regards
aGerman
Or that..
Re: Getting a batch file to search Google
Thanks for the help it now works as I wanted, I will adapt it to work with IE now I have the most difficult part (for me) sorted.
Thanks again.
Thanks again.
