Saut au contenu
Persée Portail Persée Perséides Data Persée

Powershell 2.0 Download Portable | File

GitHub often returns a redirect. WebClient does not auto-follow redirects in all cases. Use this workaround:

$download_url = "ftp://ftpserver.example.com/backup.iso" $local_path = "C:\Downloads\backup.iso" $user = "ftp_username" $pass = "ftp_password" $WebClient = New-Object System.Net.WebClient $WebClient.Credentials = New-Object System.Net.NetworkCredential($user, $pass) $WebClient.DownloadFile($download_url, $local_path) powershell 2.0 download file

Import-Module BitsTransfer Start-BitsTransfer -Source "https://example.com/largefile.zip" -Destination "C:\Downloads\largefile.zip" GitHub often returns a redirect

$webClient = New-Object System.Net.WebClient $webClient.Credentials = New-Object System.Net.NetworkCredential("username", "password") $webClient.DownloadFile("http://example.com", "C:\Docs\protected.pdf") Use code with caution. Method 2: Using the BITS Transfer Module powershell 2.0 download file

powershell 2.0 download file