-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.ps1
29 lines (26 loc) · 1.07 KB
/
install.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# ******************************************************************************
# インストール用スクリプト (Windows用)
# ******************************************************************************
$directory = Split-Path $MyInvocation.MyCommand.Path -Parent
$applications = Get-Content "$directory/Wingetfile"
Write-Output "------------------------------"
Write-Output $applications
Write-Output "------------------------------"
$choiceDescription = "System.Management.Automation.Host.ChoiceDescription"
$yes = New-Object $choiceDescription("&Yes", "Yes")
$no = New-Object $choiceDescription("&No", "No")
$choice = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
if ($host.ui.PromptForChoice("install winget applications?", "", $choice, 1) -ne 0) {
Write-Output "not install"
return
}
foreach ($app in $applications) {
Write-Output "install: $app"
& winget install -e --id $app
if ($LastExitCode -ne 0) {
Write-Output "[ERROR] aborted: $app`n"
continue
}
Write-Output "completed: $app`n"
}
Write-Output "done"