orca/scripts/updatepath.ps1

17 lines
423 B
PowerShell
Raw Permalink Normal View History

param (
[parameter(Mandatory=$true)]
2023-09-10 20:50:19 +00:00
[string]$orcaPath,
[switch]$remove
)
$arrPath = [System.Environment]::GetEnvironmentVariable('PATH', 'User') -split ';'
$arrPath = $arrPath | Where-Object { $_ -ne $orcaPath } | Where-Object { $_ -ne '' }
2023-09-10 20:50:19 +00:00
if (-not $remove) {
$arrPath += $orcaPath
}
$newPath = $arrPath -join ';'
[System.Environment]::SetEnvironmentVariable('PATH', $newPath, 'User')