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. "