Last active
July 21, 2020 13:57
-
-
Save andelf/5960f851e1cb1d4d9cdcc354f7f5fd88 to your computer and use it in GitHub Desktop.
Powershell with vcvars64.bat
This file contains 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
Import-Module 'C:\Users\mono\Repos\vcpkg\scripts\posh-vcpkg' | |
Set-PSReadLineOption -EditMode Emacs | |
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete | |
# Environment variables | |
$Env:Path = "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem" | |
# $Env:Path += ";C:\Windows\System32\WindowsPowerShell\v1.0\" | |
$Env:Path += ";C:\Program Files\PowerShell\7\" | |
$Env:Path += ";C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\" | |
$Env:Path += ";C:\ProgramData\chocolatey\bin" | |
$Env:Path += ";C:\Users\mono\AppData\Local\Programs\Python\Python38\Scripts\;C:\Users\mono\AppData\Local\Programs\Python\Python38\" | |
$Env:Path += ";C:\Users\mono\.cargo\bin" | |
$Env:Path += ";C:\Users\mono\AppData\Local\Programs\Microsoft VS Code\bin" | |
# $Env:Path += ";C:\msys64\usr\bin;C:\msys64\mingw64\bin" | |
$Env:Path += ";C:\Windows\System32\downlevel" | |
$Env:Path += ";C:\tools\git\cmd" | |
$_vars = ( | |
'LIB', | |
'INCLUDE', | |
'LIBPATH' | |
) | |
$output = cmd /c '"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat" && set' | |
$_old_loc = Get-Location | |
Set-Location -Path Env:\ | |
Write-Output $output | | |
Select-String '^([^=]*)=(.*)' | | |
ForEach-Object { $_.Matches } | | |
Where-Object { $_vars -contains $_.Groups[1].value } | | |
ForEach-Object { | |
# Write-Output $_.Groups[1].value $_.Groups[2].value | |
Set-Item -Path $_.Groups[1].value $_.Groups[2].value | |
} | |
Set-Location $_old_loc | |
$Env:VCPKGRS_DYNAMIC = 1 | |
$Env:VCPKG_DEFAULT_TRIPLET = "x64-windows" | |
# $Env:Platform = "x64" | |
Clear-Variable output | |
Clear-Variable _old_loc | |
Clear-Variable _vars | |
# Alias | |
Set-Alias -Name ifconfig -Value ipconfig | |
# choco install ntop.portable | |
Set-Alias htop ntop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment