Skip to content

Instantly share code, notes, and snippets.

@wincmd64
Created September 4, 2023 07:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wincmd64/d0ae088af570fcea17f5272a5c709242 to your computer and use it in GitHub Desktop.
Save wincmd64/d0ae088af570fcea17f5272a5c709242 to your computer and use it in GitHub Desktop.
# Download from link in clipboard preserving timestamp
$clip = (Get-Clipboard)
Write-Host URL: $clip
try { (Invoke-WebRequest $clip -Method Head).Headers.'Last-Modified' } catch { Write-Warning "Last-Modified error" }
try { (Invoke-WebRequest $clip -Method Head).Headers.'Content-Length'/1mb } catch { Write-Warning "Content-Length error" }
Write-Host `n"DOWNLOAD?" -ForegroundColor Green
pause
Start-BitsTransfer -Source $clip -Destination (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment