Set default error handling
Stop execution of a script when any error occurs
$ErrorActionPreference = [Management.Automation.ActionPreference]::Stop
Execute only if previous command was successful
Invoke-WebRequest 'https://github.com/Yetenol/shortcutFox/releases/latest/download/shortcutFox.exe' -OutFile "$env:Temp/shortcutFox.exe"
if ($?) {Start-Process "$env:Temp/shortcutFox.exe"}
Sources:
Related:
Tags: