aboutsummaryrefslogtreecommitdiff
path: root/tools/Use-VC.ps1
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-08-10 01:16:37 +0800
committercrupest <crupest@outlook.com>2021-08-10 01:16:37 +0800
commitad287bbe59b0b01cc56b90076b02a8cd9baa712e (patch)
tree2cae75e2214474eccf88f7c2f85844b21a1a438d /tools/Use-VC.ps1
parentd2448884500811bf1cd1eba89e7a4193a76c4d6b (diff)
downloadcru-ad287bbe59b0b01cc56b90076b02a8cd9baa712e.tar.gz
cru-ad287bbe59b0b01cc56b90076b02a8cd9baa712e.tar.bz2
cru-ad287bbe59b0b01cc56b90076b02a8cd9baa712e.zip
..
Diffstat (limited to 'tools/Use-VC.ps1')
-rw-r--r--tools/Use-VC.ps126
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/Use-VC.ps1 b/tools/Use-VC.ps1
new file mode 100644
index 00000000..f1274b6f
--- /dev/null
+++ b/tools/Use-VC.ps1
@@ -0,0 +1,26 @@
+function Use-VC {
+ param(
+ [Parameter()]
+ [ValidateSet('x64', 'x86')]
+ $Arch = 'x64'
+ )
+
+ if ($Arch -eq 'x86') {
+ $p = 'x86';
+ }
+ else {
+ $p = 'amd64'
+ }
+
+ $vs=$(vswhere.exe -format value -property installationPath)
+
+ cmd /c "$vs\VC\Auxiliary\Build\vcvars64.bat $p & set" |
+ ForEach-Object {
+ if ($_ -match '=') {
+ $v = $_ -split '='
+ Set-Item -Force -Path "ENV:\$($v[0])" -Value "$($v[1])"
+ }
+ }
+ Pop-Location
+ Write-Host "Visual Studio 2019 Command Prompt variables set." -ForegroundColor Yellow
+}