How to download a file using PowerShell in Windows 10

Windows PowerShell in Windows 10, is a powerful tool whose capability set multiplies manifold over that of Command Prompt. It’s might even replace Command Prompt in near future as it offers more power and control over the operating system. Microsoft developed it for task automation and configuration management process. Based on the .NET Framework, it includes a command line interface and a scripting language.

Download a file using PowerShell

Today, we are going to use Windows PowerShell to download a file from Internet with the help of simple commands. Follow on to the below steps to know how to do so:

1. Open PowerShell console as administrator. To do this, press Windows Key on your keyboard and type in powershell. Right-click Windows Powershell (Desktop App) and select Run as administrator. Select Yes in the UAC window that pops up.

2. Now, you need to copy the link of the file you want to download using PowerShell. See the below image for example:

How to download a file using Windows PowerShell in Windows 10

3. Copy and paste the following command in Notepad.

$client = new-object System.Net.WebClient
$client.DownloadFile(“Download Link”,“File Destination\file name.file extension”)

4. Now, in the above command, replace Download Link with the link you copied in Step 2. Insert the download location path along with the name you want to save the file with, along with its extension in place of File Destination\file name.file extension. DO NOT remove the double quotes. See the below example for the modifying the command:

$client = new-object System.Net.WebClient

5. Now, copy the modified command and paste it in the PowerShell window. Hit Enter to download the file.

download a file using PowerShell

6. That’s it! You can navigate to the download folder path to find your file stored there.

How to download a file using Windows PowerShell in Windows 10

If downloading any file requires you to enter credentials of some sort like server login details etc., then you can use the following command to download the file in one shot:

$client = new-object System.Net.WebClient
$client.Credentials = Get-Credential

Let us know in the comments section below if you are facing any issue while trying to download the file.

Posted by on , in Category Windows with Tags
Driven by my immense passion for Windows & other Microsoft technologies, I love to keep myself abreast of the latest strides and swings in the world of technology. I am fond of traveling to mountains & love to help others with their technical or non-technical setbacks.