Created
March 17, 2018 16:27
-
-
Save JohnLBevan/1042571860741781e55e8e135f15bbc7 to your computer and use it in GitHub Desktop.
Path environment variable too long; trim down some of the SQL entries by replacing with other environment variables...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cls | |
| [Environment]::SetEnvironmentVariable("MSSQL64",'C:\Program Files\Microsoft SQL Server',"Machine") | |
| [Environment]::SetEnvironmentVariable("MSSQL86",'C:\Program Files (x86)\Microsoft SQL Server',"Machine") | |
| $path = [Environment]::GetEnvironmentVariable("PATH","User") | |
| $path = ($path -replace 'C:\\Program Files\\Microsoft SQL Server\\','%MSSQL64%\') -replace 'C:\\Program Files \(x86\)\\Microsoft SQL Server\\','%MSSQL86%\' | |
| [Environment]::SetEnvironmentVariable("PATH",$path,"User") | |
| $path = [Environment]::GetEnvironmentVariable("PATH","Machine") | |
| $path = ($path -replace 'C:\\Program Files\\Microsoft SQL Server\\','%MSSQL64%\') -replace 'C:\\Program Files \(x86\)\\Microsoft SQL Server\\','%MSSQL86%\' | |
| [Environment]::SetEnvironmentVariable("PATH",$path,"Machine") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment