mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
resolve comments
This commit is contained in:
22
images/win/post-generation/Update-DotnetPath.ps1
Normal file
22
images/win/post-generation/Update-DotnetPath.ps1
Normal file
@@ -0,0 +1,22 @@
|
||||
$latestPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine)
|
||||
|
||||
$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"
|
||||
}
|
||||
|
||||
$updatedPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::Machine)
|
||||
Write-Host "Windows PATH: $updatedPath"
|
||||
Reference in New Issue
Block a user