win-build/win_build_tools_install.ps1

22 lines
834 B
PowerShell
Raw Permalink Normal View History

2021-02-18 18:39:35 +00:00
param([parameter()][string] $msvc="C:\msvc")
new-item -path $msvc -type directory -force
new-item -path "temp" -type directory -force
2023-03-27 17:16:49 +00:00
invoke-webrequest https://aka.ms/vs/17/release/channel -outfile temp\visualstudio.release.chman
invoke-webrequest https://aka.ms/vs/17/release/vs_buildtools.exe -outfile temp\vs_buildtools.exe
2021-02-18 18:39:35 +00:00
$arguments = @(
"--quiet", "--wait", "--norestart", "--nocache",
"--channeluri", ($pwd.path + "\temp\visualstudio.release.chman"),
"--installchanneluri", ($pwd.path + "\temp\visualstudio.release.chman"),
2023-03-27 17:16:49 +00:00
"--config", ($pwd.path + "\vs17.config"),
2021-02-18 18:39:35 +00:00
"--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")