Skip to content

Commit

Permalink
added cmd /c for wget and curl
Browse files Browse the repository at this point in the history
cmd /c is a Command Prompt setting to run command prompts from within powershell leaving put the issue for vscode auto helper functions to convert to Invoke web request
  • Loading branch information
coff33ninja committed Sep 28, 2023
1 parent e073832 commit ade1abb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions AdminLaunchOption.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ catch {

foreach ($url in $downloadURLs) {
try {
wget $url -O $destination # <-- Changed $downloadURL to $url
cmd /c wget $url -O $destination # <-- Changed $downloadURL to $url
Write-Output 'Downloaded using wget.'
$downloaded = $true
break
}
catch {
try {
curl -L $url -o $destination # <-- Changed $downloadURL to $url
cmd /c curl -L $url -o $destination # <-- Changed $downloadURL to $url
Write-Output 'Downloaded using curl.'
$downloaded = $true
break
Expand Down Expand Up @@ -155,7 +155,7 @@ catch {

# Check wget version
try {
$wgetVersion = wget --version | Select-Object -First 1
$wgetVersion = cmd /c wget -h | Select-Object -First 1
Write-Output $wgetVersion
}
catch {
Expand All @@ -164,7 +164,7 @@ catch {

# Check curl version
try {
$curlVersion = curl --version | Select-Object -First 1
$curlVersion = cmd /c curl --version | Select-Object -First 1
Write-Output $curlVersion
}
catch {
Expand Down Expand Up @@ -212,14 +212,14 @@ $downloaded = $false

foreach ($url in $downloadURLs) {
try {
Invoke-WebRequest $url -O $destination # Use $url not $downloadURLs
cmd /c wget $url -O $destination # Use $url not $downloadURLs
Write-Output 'Downloaded using wget.'
$downloaded = $true
break
}
catch {
try {
Invoke-WebRequest -L $url -o $destination # Use $url not $downloadURLs
cmd /c curl -L $url -o $destination # Use $url not $downloadURLs
Write-Output 'Downloaded using curl.'
$downloaded = $true
break
Expand Down

0 comments on commit ade1abb

Please sign in to comment.