use ie to google all running tasks (for tokens delims)

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
confuseis
Posts: 11
Joined: 11 Dec 2011 09:59

use ie to google all running tasks (for tokens delims)

#1 Post by confuseis » 11 Dec 2011 13:01

for /f "tokens=1 delims=" %%A in ("c:\windows\system32\tasklist.exe") do "C:\Program Files\Internet Explorer\iexplore.exe" %%A ¶


Hi all

above is where Im at so far. I want to use the tasklist command to list all processes running and then the above line to feed in the 1st word per line in the output (the name of the task) and essentially google each task running saving me the typing. maybe there is an easier way? In any case its a chance for me to learn this pesky for comand.

Thanks for reading.

orange_batch
Expert
Posts: 442
Joined: 01 Aug 2010 17:13
Location: Canadian Pacific
Contact:

Re: use ie to google all running tasks (for tokens delims)

#2 Post by orange_batch » 11 Dec 2011 13:44

Code: Select all

for /f "delims=, tokens=1" %%a in ('tasklist /fo csv /nh') do start iexplore "http://www.google.com/search?q=%%~a"

My version of IE is 7 because I don't use it. Maybe newer versions support multiple websites via arguments like Firefox does. In that case, I would use this:

Code: Select all

@echo off&setlocal enabledelayedexpansion
for /f "delims=, tokens=1" %%a in ('tasklist /fo csv /nh') do set args=!args! "google.com/search?q=%%~a"
start iexplore !args!

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: use ie to google all running tasks (for tokens delims)

#3 Post by aGerman » 11 Dec 2011 14:52

Be careful! If you run approx. 100 instances of Internet Explorer your machine will probably freeze because of 100% CPU use.

Regards
aGerman

confuseis
Posts: 11
Joined: 11 Dec 2011 09:59

Re: use ie to google all running tasks (for tokens delims)

#4 Post by confuseis » 18 Dec 2011 11:09

That works great mate. Now to begin learning the code. Yeah it does tie the processor up momentarily but still quicker than googling each individually

Thanks guys and Merry Chrstmas

Post Reply