mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
39 lines
1.2 KiB
PowerShell
39 lines
1.2 KiB
PowerShell
$isPathUpdated = $false
|
|
$hgPath = "$Env:ProgramFiles\Mercurial\"
|
|
$latestPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine)
|
|
|
|
if (Test-Path -Path $hgPath)
|
|
{
|
|
$latestPath = "$hgPath;$latestPath"
|
|
Write-Host "Added Mercurial to PATH"
|
|
$isPathUpdated = $true
|
|
}
|
|
else
|
|
{
|
|
Write-Host "Didn't find Mercurial at $hgPath. Skipping adding PATH to it."
|
|
}
|
|
|
|
$dotnetPath = "$env:USERPROFILE\.dotnet\tools"
|
|
if ($latestPath.Contains("C:\Users\VssAdministrator\.dotnet\tools"))
|
|
{
|
|
$latestPath = $latestPath.Replace("C:\Users\VssAdministrator\.dotnet\tools", "$dotnetPath")
|
|
$isPathUpdated = $true
|
|
}
|
|
|
|
if (-not $latestPath.Contains($dotnetPath))
|
|
{
|
|
$latestPath = "$dotnetPath;$latestPath"
|
|
Write-Host "Added .dotnet\tools $dotnetPath to PATH"
|
|
$isPathUpdated = $true
|
|
}
|
|
else
|
|
{
|
|
Write-Host "$dotnetPath already in PATH"
|
|
}
|
|
|
|
if ($isPathUpdated)
|
|
{
|
|
[System.Environment]::SetEnvironmentVariable('PATH', $latestPath, [System.EnvironmentVariableTarget]::Machine)
|
|
}
|
|
$updatedPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine)
|
|
Write-Host "Windows PATH: $updatedPath" |