Reading Txt Files From Bat File

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
elyfrank
Posts: 2
Joined: 07 Dec 2012 18:39

Reading Txt Files From Bat File

#1 Post by elyfrank » 07 Dec 2012 18:42

Hi guys,
I managed to write this script to open a link in internet explorer close it and open another one.
I would like to have all my links in a different txt files with multiple links line by line and be able to do the same function reading it from the bat file

I will appreciate anybody that can help me with this.
This is the bat file I made which works great. It opens these two llinks one at a time and do some stuff.

@echo off
start /MIN iexplore.exe www.website1.com
ping 192.178.1.1 -w 1
ping 192.178.1.1 -w 1
ping 192.178.1.1 -w 1
ping 192.178.1.1 -w 1
ping 192.178.1.1 -w 1
ping 192.178.1.1 -w 1
ping 192.178.1.1 -w 1
tskill iexplore /A
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255
start /MIN iexplore.exe www.website2.com
ping 192.178.1.1 -w 1
ping 192.178.1.1 -w 1
ping 192.178.1.1 -w 1
ping 192.178.1.1 -w 1
ping 192.178.1.1 -w 1
ping 192.178.1.1 -w 1
ping 192.178.1.1 -w 1
ping 192.178.1.1 -w 1
ping 192.178.1.1 -w 1
tskill iexplore /A
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255

Thank you very much

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Reading Txt Files From Bat File

#2 Post by foxidrive » 07 Dec 2012 19:23

This is untested:

Code: Select all

@echo off
for /f "delims=" %%a in (url.txt) do (
start "" /MIN iexplore.exe "%%a"
ping -n 30 localhost
tskill iexplore /A
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255
)
pause



url.txt
www.google.com
bbc.co.uk
nbc.com

elyfrank
Posts: 2
Joined: 07 Dec 2012 18:39

Re: Reading Txt Files From Bat File

#3 Post by elyfrank » 07 Dec 2012 19:55

That worked like a charm! thank you very much

Post Reply