win-build/winxp_build_tools_install.ps1

22 lines
834 B
PowerShell

param([parameter()][string] $msvc="C:\msvc")
new-item -path $msvc -type directory -force
new-item -path "temp" -type directory -force
invoke-webrequest https://aka.ms/vs/15/release/channel -outfile temp\visualstudio.release.chman
invoke-webrequest https://aka.ms/vs/15/release/vs_buildtools.exe -outfile temp\vs_buildtools.exe
$arguments = @(
"--quiet", "--wait", "--norestart", "--nocache",
"--channeluri", ($pwd.path + "\temp\visualstudio.release.chman"),
"--installchanneluri", ($pwd.path + "\temp\visualstudio.release.chman"),
"--config", ($pwd.path + "\vs15.config"),
"--installpath", "$msvc"
)
$proc = Start-Process -FilePath "temp\vs_buildtools.exe" -ArgumentList $arguments
$proc.WaitForExit()
Remove-Item "temp" -Recurse
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$msvc", "Machine")