Created
March 7, 2022 04:15
-
-
Save crazy4groovy/09e596762e9ae6e05c3d2d2f7f0cc29b to your computer and use it in GitHub Desktop.
Download strings and files (PowerShell)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$WC = New-Object net.webclient | |
$htmlUri = "https://www.google.com" | |
$jpgUri = "https://www.example.com/example-image.jpg" | |
$Content = $WC.DownloadString($htmlUri) | |
$WC.DownloadFile($jpgUri, "C:\Temp\myimage.jpg") | |
# see TLS 1.2: https://stackoverflow.com/questions/41618766/powershell-invoke-webrequest-fails-with-ssl-tls-secure-channel/41618979#41618979 | |
# invoke-webrequest $jpgUri -Outfile "C:\Temp\myimage.jpg" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment