0
$Interweb = Join-Path $env:USERPROFILE 'downloads\filename.exe'
Invoke-WebRequest -Uri "http://urldownload.exe" -OutFile $Interweb

Currently the above works in PS v2.0 however im trying to run this on machines with a lower version. Is there a way to do this in PS v1.0?

Ansgar Wiechers
  • 175,025
  • 22
  • 204
  • 278
  • take a look here: http://stackoverflow.com/questions/28143160/how-can-i-download-a-file-with-batch-file-without-using-any-external-tools . – npocmaka Feb 02 '17 at 12:22
  • net webclient? https://learn-powershell.net/2011/02/11/using-powershell-to-query-web-site-information/ – 4c74356b41 Feb 02 '17 at 12:23
  • @4c74356b41 `New-Object` was introduced in v 2.0 – Mathias R. Jessen Feb 02 '17 at 12:44
  • sorry, I'm not a big expert in 1.0 :) – 4c74356b41 Feb 02 '17 at 12:45
  • All Windows operating systems still supported by Microsoft can run at least PowerShell v2. I strongly recommend upgrading to at least that version instead of trying to work around limitations of v1. – Ansgar Wiechers Feb 02 '17 at 13:17
  • Possible duplicate of [How can I download a file with batch file without using any external tools?](http://stackoverflow.com/questions/28143160/how-can-i-download-a-file-with-batch-file-without-using-any-external-tools) – TravisEz13 Feb 02 '17 at 17:21

0 Answers0