fix environment path

This commit is contained in:
Aleksandr Chebotov
2020-03-31 10:47:49 +03:00
parent ad58d07d91
commit 7bb78afa9c

View File

@@ -100,16 +100,10 @@ function RunPostInstallationSteps()
{
Add-MachinePathItem "C:\Program Files\dotnet"
# Run script at startup for all users
$cmdDotNetPath = @'
@echo off
powershell -executionpolicy bypass -noprofile -command "[System.Environment]::SetEnvironmentVariable('PATH',"""$env:USERPROFILE\.dotnet\tools;$env:PATH""", 'USER')"
'@
$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