Sometimes, you need to download a file directly from the Command Prompt (CMD). It’s simple, quick, and doesn’t require opening a browser. Here’s how to do it step-by-step. 😉
CURL Command on CMD
For Windows 10 and later, there is a built-in tool called Curl that can be used to download files using the command line. It’s pretty simple: open your command prompt by pressing the Win + R key on your keyboard, typing cmd on the search bar that appeared, and then hitting the Enter key.
Then type the below command, replacing the download URL of your file:
curl -O https://example.com/file.zip
This will download the file and save it with the same name as on the website.
Want to rename the file as you download it? Use this:
curl -o MyFile.zip https://example.com/file.zip
Invoke-WebRequest Command on PowerShell
Invoke-WebRequest functions similarly to the curl command, but in PowerShell. To download a file using this command, replace the URL with your file’s URL as shown in the command below:
Invoke-WebRequest https://example.com/file.zip -OutFile file.zip
This will save the file as file.zip
in your current directory.
BITSADMIN Command for Older Versions of Windows
Windows XP, Vista, Windows 7, 8/8.1, and Windows 10 don’t support the curl and Invoke-WebRequest commands. In this case, you can use bitsadmin. To use it, open CMD and type the below command, replacing the download URL of your file:
bitsadmin /transfer myDownloadJob /download /priority normal https://example.com/file.zip C:\Users\yourusername\Downloads\file.zip
The file will be saved to the location C:\Downloads
.
WGET Command for Linux Lovers on Windows
The WGET command is available on Windows but requires manual installation. It is a built-in utility in Linux, making it easier for Linux users to use the same command on Windows OS as well.
To use WGET, download wget
from the internet (Google “wget for Windows”). And then add to the system path. To do this, follow the steps:
- Open your browser and search for “wget for Windows.”
- Go to a trusted source like Eternallybored.org or another reliable website.
- Download the
wget.exe
file. Choose the version that matches your system (32-bit or 64-bit). - Once downloaded, locate the
wget.exe
file (usually in yourDownloads
folder). - Move it to the location:
C:\Windows\System32\
Now you’re all set to use wget on your Windows system for downloading files. You can now open CMD and type after replacing the file URL in the below sample command:
wget https://example.com/file.zip
With this guide, you’ve covered all the methods to download a file from the CMD (command line) like a pro! 😃👏