Noob question: Need to get foreach results between quotes for the foreach variable

Basically, problem is this: I have an Invoke-WebRequest in a foreach loop linked to a variable. Problem is the URLs appear like that:

$urlList = “url1, url2, url3”

How can I get each results between quotes like the following example?

$urlList = “url1”, “url2”, “url3”

Here’s the full part of the code:

$linkList = foreach ($url in $urlList) {

(Invoke-WebRequest -Uri $url).Links.Href | select-string “.zip” | select-object -First 1

$link = $linkList.getenumerator()

$dir = $dirList.getenumerator()

while ($link.MoveNext() -and $dir.MoveNext()) {

$WebClient.DownloadFile($link.Current , $dir.Current)


If any are willing to help, it would be greatly appreciated!

submitted by /u/jay_p_666
[link] [comments]

Leave a Reply