1 & "${env:COMSPEC}" /c ActivateMSVC.bat "&&" set | ForEach-Object {
2     if ($_.Contains("=")) {
3         $name, $value = $_ -split '=', 2
4         Set-Content env:\"$name" $value
5     }
6 }
7 
8 $MissingTools = $false
9 $tools = "cl", "link", "rc", "mt"
10 $descriptions = "MSVC Compiler", "MSVC Linker", "MS Windows Resource Compiler", "MS Windows Manifest Tool"
11 for ($i = 0; $i -lt $tools.Length; $i++) {
12     $present = $true
13     try {
14         Get-Command $tools[$i] *>&1 | Out-Null
15         $present = $present -and $?
16     } catch {
17         $present = $false
18     }
19     if (!$present) {
20         Write-Warning "$($tools[$i]) ($($descriptions[$i])) missing."
21         $MissingTools = $true
22     }
23 }
24 
25 if ($MissingTools) {
26     Write-Error "Some build tools were unavailable after activating MSVC in the shell. It's likely that your Visual Studio $MSVC_DISPLAY_YEAR installation needs repairing."
27     exit 1
28 }