Skip to content

Instantly share code, notes, and snippets.

@stopthatastronaut
Created June 7, 2017 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stopthatastronaut/0e8c9e0067b2048353fec3d6dc1575ac to your computer and use it in GitHub Desktop.
Save stopthatastronaut/0e8c9e0067b2048353fec3d6dc1575ac to your computer and use it in GitHub Desktop.
Download files from an array of URLs
# Here's our array of files
$files = @(
"https://download.octopusdeploy.com/octopus/Octopus.3.13.9-x64.msi",
"https://download.octopusdeploy.com/octopus/Octopus.Tentacle.3.13.9-x64.msi",
"https://download.octopusdeploy.com/octopus/Octopus.3.13.10-x64.msi",
"https://download.octopusdeploy.com/octopus/Octopus.Tentacle.3.13.10-x64.msi"
# etctera
)
# loop through the array, extract the filename using uri segments, download the file
$files | % {
$filename = ([uri]$_).segments | select -Last 1
iwr $_ -OutFile $filename
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment