24 строки
1.3 KiB
PowerShell
24 строки
1.3 KiB
PowerShell
if (!(Test-Path function:AddToStatus)) {
|
|
function AddToStatus([string]$line, [string]$color = "Gray") {
|
|
("<font color=""$color"">" + [DateTime]::Now.ToString([System.Globalization.DateTimeFormatInfo]::CurrentInfo.ShortTimePattern.replace(":mm",":mm:ss")) + " $line</font>") | Add-Content -Path "c:\demo\status.txt" -Force -ErrorAction SilentlyContinue
|
|
Write-Host -ForegroundColor $color $line
|
|
}
|
|
}
|
|
|
|
$Folder = "C:\DOWNLOAD\VisualStudio2017Community"
|
|
$Filename = "$Folder\vs_community.exe"
|
|
New-Item $Folder -itemtype directory -ErrorAction ignore | Out-Null
|
|
|
|
if (!(Test-Path $Filename)) {
|
|
AddToStatus "Downloading Visual Studio 2017 Community Setup Program"
|
|
$WebClient = New-Object System.Net.WebClient
|
|
$WebClient.DownloadFile("https://aka.ms/vs/15/release/vs_community.exe", $Filename)
|
|
}
|
|
|
|
AddToStatus "Installing Visual Studio 2017 Community (this might take a while)"
|
|
$setupParameters = “--quiet --norestart"
|
|
Start-Process -FilePath $Filename -WorkingDirectory $Folder -ArgumentList $setupParameters -Wait -Passthru | Out-Null
|
|
|
|
$setupParameters = “--quiet --norestart --add Microsoft.VisualStudio.Component.Windows10SDK.14393"
|
|
Start-Process -FilePath $Filename -WorkingDirectory $Folder -ArgumentList $setupParameters -Wait -Passthru | Out-Null
|