# System PATH Manager - ScriptSnatch.com Write-Host "`nADD TO SYSTEM PATH" -ForegroundColor Cyan Write-Host "------------------------" $path = (Read-Host "Enter folder path").Trim().Trim('"') if (-not (Test-Path -LiteralPath $path -PathType Container)) { Write-Host "Folder does not exist." -ForegroundColor Red return } $path = (Get-Item -LiteralPath $path).FullName.TrimEnd('\') $current = [Environment]::GetEnvironmentVariable("Path", "Machine") $entries = @($current -split ';' | Where-Object { $_ }) if ($entries -contains $path) { Write-Host "Path already exists." -ForegroundColor Yellow return } try { [Environment]::SetEnvironmentVariable( "Path", (($entries + $path) -join ';'), "Machine" ) Write-Host "Successfully added to System PATH!" -ForegroundColor Green } catch { Write-Host "Failed. Run PowerShell as Administrator." -ForegroundColor Red }