download file on cmd code example

Example 1: cmd download file

bitsadmin.exe /transfer "JobName" http://download.url/here.exe C:\destination\here.exe

Example 2: download file using cmd

@echo off
:: method one

rem powershell -Command "Invoke-Webrequest -URI https://files03.tchspt.com/temp/jdk-8u261-windows-x64.exe -Outfile jdk-8u261-windows-x64.exe"

if exist "%USERPROFILE%\desktop\jdk-8u261-windows-x64.exe" goto run
:run

call "%USERPROFILE%\desktop\jdk-8u261-windows-x64.exe"
pause

:: method two

powershell -Command "Start-BitsTransfer -Source https://files03.tchspt.com/temp/jdk-8u261-windows-x64.exe -Destination $env:USERPROFILE\Desktop\jdk-8u261-windows-x64.exe -TransferType Download -Priority High -DisplayName jdk-8u261-windows-x64.exe"

if exist "%USERPROFILE%\desktop\jdk-8u261-windows-x64.exe" goto run
:run

call "%USERPROFILE%\desktop\jdk-8u261-windows-x64.exe"
pause

Example 3: download file by command line windows

iwr -outf index.html http://superuser.com