A set of PowerShell scripts that install a base developer environment and multiple languages for Windows.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
lcthw-windows-installers/pathfixer.ps1

34 lines
1.7 KiB

Write-Warning "===== Writing a backup of your path to path_backup.txt in case this goes wrong."
Out-File -FilePath .\path_backup.txt -InputObject $env:PATH
Write-Host "======= winlibs configuration ====="
$winlibsPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$env:APPDATA\..\Local\Programs\WinLibs")
if($env:PATH.contains($winlibsPath)) {
Write-Warning "!! Detected $winLibsPath in your PATH. Will not update your PATH."
Write-Host "Looks like your WinLibs is working."
} else {
$newPath = $env:PATH + ";$winlibsPath\mingw64\bin"
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
}
Write-Host "====== git path configuration ======"
$gitPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("$env:APPDATA\..\Local\Programs\Git\cmd")
if($env:PATH.contains($gitPath)) {
Write-Warning "!! Detected $gitPath in your PATH. Will not update your PATH."
Write-Host "Looks like your git installed correctly, but if it fails to run then uninstall it with 'winget remove git.git' then install it again with 'winget install git.git'"
} else {
Write-Warning "!! Git.Git did not add itself to the Path. The directory $gitPath is missing so I'll add it now."
$newPath = $env:PATH + ";$gitPath"
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
Write-Warning "!!!!!!!!!!! If git doesn't work after this you'll have to manually remove it and add it with:"
Write-Host "winget remove git.git"
Write-Host "winget install git.git"
}
Write-Warning "================================"
Write-Warning "You should now close this terminal, start a new one, and run this script again to confirm your paths are set."