Last active
March 11, 2020 10:35
-
-
Save ousttrue/24538d2bd7efa72e5e5c082806cfa070 to your computer and use it in GitHub Desktop.
Display changes of environment variables by 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
{ | |
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "build", | |
"type": "shell", | |
"command": "meson build --backend vs", | |
"options": { | |
"env": { | |
"VSINSTALLDIR": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\", | |
"PATH": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX64\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.18362.0\\x64;", | |
"INCLUDE": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\ATLMFC\\include;C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\include;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\ucrt;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\shared;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\um;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\winrt;C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\cppwinrt", | |
"LIB": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\lib\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.18362.0\\ucrt\\x64;C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.18362.0\\um\\x64;", | |
} | |
}, | |
"group": { | |
"kind": "build", | |
"isDefault": true | |
}, | |
"problemMatcher": [] | |
} | |
] | |
} |
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
$ErrorActionPreference = "Stop" | |
$path = Get-VSSetupInstance ` | |
| Select-VSSetupInstance -Require Microsoft.VisualStudio.Workload.NativeDesktop -Latest ` | |
| Select-Object -ExpandProperty InstallationPath; | |
# echo $path | |
$bat = "$path\VC\Auxiliary\Build\vcvars64.bat" | |
$before = cmd /c "set" | |
$after = cmd /c "`"$bat`" > NUL & set" | |
function ToMap($src) | |
{ | |
$map = @{} | |
foreach($l in $src) | |
{ | |
$k, $v = $l.split('=') | |
$map.Add($k, $v) | |
} | |
return $map | |
} | |
$before = ToMap($before) | |
$beforePath = $before["PATH"].split(';') | |
$before.remove("PATH") | |
$after = ToMap($after) | |
$afterPath = $after["PATH"].split(';') | |
$after.remove("PATH") | |
$ignore = @("__VSCMD_PREINIT_PATH") | |
foreach($k in $after.Keys) | |
{ | |
if($ignore -Contains $k) | |
{ | |
continue | |
} | |
if($before[$k]) | |
{ | |
if($before[$k] -ne $after[$k]) | |
{ | |
echo "mod: ${k}: $($before[$k]) => $($after[$k])" | |
} | |
} | |
else{ | |
echo "add: ${k} => $($after[$k])" | |
} | |
} | |
foreach($p in $afterPath) | |
{ | |
if($beforePath -Contains $p) | |
{ | |
# echo "contain: ${p}" | |
continue | |
} | |
echo "path: ${p}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment