Skip to content

PowerShell: Download the File from the URL

In this post, you will learn three different ways to download remote files using the URL in Powershell.

Below are three different ways that you can download a file in PowerShell.

  1. Invoke-WebRequest more
  2. Start-BitsTransfer more
  3. New-Object more

In all of the below methods, $URL is the HTTP or HTTPS URL of the file you want to download and $Path is the local file system path where you want to save the downloaded file.

Example values:

$URL = "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
$Path = "d:\images\googlelogo.png"

Download Using Invoke-WebRequest cmdlet

Invoke-WebRequest -URI $URL -OutFile $Path

Download Using Start-BitsTransfer cmdlet

Start-BitsTransfer -Source $URL -Destination $Path

Download Using New-Object cmdlet

(New-Object System.Net.WebClient).DownloadFile ($URL, $Path)
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments