Download Files in Windows

We can download files from websites in Windows from command line, like ‘wget’ command of Linux.

Using Invoke-WebRequest

We can use Invoke-WebRequest command

# In PowerShell
Invoke-WebRequest -Uri https://example.com/hello.txt -Outfile .\hello.txt
IWR -Uri https://example.com/hello.txt -Outfile .\hello.txt

# In CMD, we need to call `powershell` or `powershell.exe` command.
powershell Invoke-WebRequest -Uri https://example.com/hello.txt -Outfile .\hello.txt
powershell IWR -Uri https://example.com/hello.txt -Outfile .\hello.txt