Using PowerShell to check if URLs are valid

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
born2achieve
Posts: 51
Joined: 16 Nov 2014 20:28

Re: Using PowerShell to check if URLs are valid

#16 Post by born2achieve » 07 Sep 2015 06:35

Hi Meerkat,

thanks for the reply and it worked but this logic takes more time. assume i have 10000 urls in the text file. i tried with foxidrive's sample and it took about a minute to run completely. Is there any better way to speed up this

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

Re: Using PowerShell to check if URLs are valid

#17 Post by foxidrive » 07 Sep 2015 06:51

born2achieve wrote:thanks for the reply and it worked but this logic takes more time.

It's hard to understand how that would take much more time as it's only printing to the console.

Caching may be involved in the timing in your tests - where the DNS lookups are cached and the second time it runs much faster.

I tried to make the powershell pipeline output all requests to the screen, as well as the results to the file, and failed miserably.
write-host and write-output should do it as far as I can see but where and how to include them?
I also tried adding tee but failed.

I don't know a lot about powershell. 8)

Post Reply