Hi,
I made a script in which i am downloading a software from a url and made the whole environment for that in script but it is not running. Here is the script -
$url = “http://nuget.org/nuget.exe”
$output = “$PSScriptRoot\nuget.exe”
$start_time = Get-Date
$downloadpath = “C:\Users\ankitpar\Downloads”
Invoke-WebRequest -Uri $url -OutFile $output Set-Location $downloadpath
Write-Output “Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)”
Error given on execution is -
Invoke-WebRequest :
A positional parameter cannot be found that accepts argument ‘Set-Location’.
At line:4 char:1
- Invoke-WebRequest -Uri $url -OutFile $output Set-Location C: