Merge pull request #647 from al-cheb/al-cheb/fix_environment_path

Fix user environment  PATH variable
This commit is contained in:
Alejandro Pauly
2020-04-01 12:45:21 -04:00
committed by GitHub

View File

@@ -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