aboutsummaryrefslogtreecommitdiff
path: root/scripts/Use-VC.ps1
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-11-04 21:35:33 +0800
committerYuqian Yang <crupest@crupest.life>2025-11-04 21:35:33 +0800
commit08cce61ac9e4b7ebb557b68d57097bd7eab930f3 (patch)
tree0e97c24a9ed539fd10ffd0c5ba5af2eb179f2486 /scripts/Use-VC.ps1
parent327f54b605b92a7b81a5a4de95f9f3741b786be5 (diff)
downloadcru-08cce61ac9e4b7ebb557b68d57097bd7eab930f3.tar.gz
cru-08cce61ac9e4b7ebb557b68d57097bd7eab930f3.tar.bz2
cru-08cce61ac9e4b7ebb557b68d57097bd7eab930f3.zip
Remove unused tools.
Diffstat (limited to 'scripts/Use-VC.ps1')
-rw-r--r--scripts/Use-VC.ps124
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/Use-VC.ps1 b/scripts/Use-VC.ps1
new file mode 100644
index 00000000..ad3dbcba
--- /dev/null
+++ b/scripts/Use-VC.ps1
@@ -0,0 +1,24 @@
+function Use-VC {
+ param(
+ [Parameter()]
+ [ValidateSet('x64', 'x86')]
+ $Arch = 'x64'
+ )
+
+ if ($Arch -eq 'x86') {
+ $p = 'x86';
+ }
+ else {
+ $p = 'amd64'
+ }
+
+ cmd /c "`"$(vswhere.exe -format value -property installationPath)\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 Command Prompt variables set." -ForegroundColor Yellow
+}