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/16/release/channel -outfile temp\visualstudio.release.chman invoke-webrequest https://aka.ms/vs/16/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 + "\vs16.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")