mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-24 10:28:10 +08:00
Merge pull request #647 from al-cheb/al-cheb/fix_environment_path
Fix user environment PATH variable
This commit is contained in:
@@ -100,16 +100,10 @@ function RunPostInstallationSteps()
|
||||
{
|
||||
Add-MachinePathItem "C:\Program Files\dotnet"
|
||||
# Run script at startup for all users
|
||||
$cmdDotNetPath = @"
|
||||
@echo off
|
||||
SETX PATH "%USERPROFILE%\.dotnet\tools;%PATH%"
|
||||
"@
|
||||
|
||||
$cmdPath = "C:\Program Files\dotnet\userpath.bat"
|
||||
$cmdDotNetPath | Out-File -Encoding ascii -FilePath $cmdPath
|
||||
$cmdDotNet = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -Command "[System.Environment]::SetEnvironmentVariable(''PATH'',"""$env:USERPROFILE\.dotnet\tools;$env:PATH""", ''USER'')"'
|
||||
|
||||
# Update Run key to run a script at logon
|
||||
Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "DOTNETUSERPATH" -Value $cmdPath
|
||||
Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Run" -Name "DOTNETUSERPATH" -Value $cmdDotNet
|
||||
}
|
||||
|
||||
InstallAllValidSdks
|
||||
|
||||
Reference in New Issue
Block a user