Skip to content

Commit d3abac4

Browse files
author
Markus Fleschutz
committed
Update install-basic-apps.ps1 and basic-apps.csv
1 parent 652fd1f commit d3abac4

File tree

2 files changed

+28
-26
lines changed

2 files changed

+28
-26
lines changed

data/basic-apps.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
APPLICATION, CATEGORY, APPID,
2-
"7-Zip for Windows", "file utility", "XPDNKVCX4QD2DC",
2+
"7-Zip", "file utility", "7zip.7zip",
33
"Aquile Reader", "ebook reader", "9P08T4JLTQNK",
44
"CrystalDiskInfo", "HDD/SSD utility", "XP8K4RGX25G3GM",
55
"Dopamine", "audio player", "Digimezzo.Dopamine.2",

scripts/install-basic-apps.ps1

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,48 @@
66
NOTE: Apps from Microsoft Store are preferred (due to security and automatic updates).
77
.EXAMPLE
88
PS> ./install-basic-apps.ps1
9-
⏳ (1/37) Loading Data/basic-apps.csv... 35 apps
10-
⏳ (2/37) These apps will be installed or upgraded: 7-Zip · Aquile Reader ...
9+
⏳ (1) Loading data/basic-apps.csv... 37 apps listed
10+
⏳ (2) Applications to install/upgrade: 7-Zip · Aquile Reader ...
11+
...
12+
✔️ Installed 37 basic apps (0 skipped) in 387 sec.
1113
.LINK
1214
https://github.com/fleschutz/PowerShell
1315
.NOTES
1416
Author: Markus Fleschutz | License: CC0
1517
#>
1618

1719
try {
18-
$StopWatch = [system.diagnostics.stopwatch]::startNew()
20+
$stopWatch = [system.diagnostics.stopwatch]::startNew()
1921

20-
Write-Host "⏳ (1/37) Loading Data/basic-apps.csv... " -noNewline
21-
$Table = Import-CSV "$PSScriptRoot/../data/basic-apps.csv"
22-
$NumEntries = $Table.count
23-
"$NumEntries apps"
24-
Write-Host "⏳ (2/37) These apps will be installed or upgraded: " -noNewline
25-
foreach($Row in $Table) {
26-
[string]$AppName = $Row.APPLICATION
27-
Write-Host "$AppName · " -noNewline
22+
Write-Host "⏳ (1) Loading data/basic-apps.csv... " -noNewline
23+
$table = Import-CSV "$PSScriptRoot/../data/basic-apps.csv"
24+
$numEntries = $table.count
25+
"$numEntries apps listed"
26+
Write-Host "⏳ (2) Applications to install/upgrade: " -noNewline
27+
foreach($row in $table) {
28+
[string]$appName = $row.APPLICATION
29+
Write-Host "$appName · " -noNewline
2830
}
2931
""
3032
""
31-
"Installation will start in 15 seconds... (otherwise press <Control> <C> to abort)"
33+
"The installation will start in 15 seconds or press <Control> <C> to abort..."
3234
Start-Sleep -seconds 15
3335

34-
[int]$Step = 3
35-
[int]$Skipped = 0
36-
foreach($Row in $Table) {
37-
[string]$AppName = $Row.APPLICATION
38-
[string]$Category = $Row.CATEGORY
39-
[string]$AppID = $Row.APPID
36+
[int]$step = 3
37+
[int]$numSkipped = 0
38+
foreach($row in $table) {
39+
[string]$appName = $row.APPLICATION
40+
[string]$category = $row.CATEGORY
41+
[string]$appID = $row.APPID
4042
Write-Host " "
41-
Write-Host "⏳ ($Step/$($NumEntries + 2)) Installing $Category '$AppName'..."
42-
& winget install --id $AppID --accept-package-agreements --accept-source-agreements
43-
if ($lastExitCode -ne "0") { $Skipped++ }
44-
$Step++
43+
Write-Host "⏳ ($step/$($numEntries + 2)) Installing $category '$appName'..."
44+
& winget install --id $appID --accept-package-agreements --accept-source-agreements
45+
if ($lastExitCode -ne "0") { $numSkipped++ }
46+
$step++
4547
}
46-
[int]$Installed = ($NumEntries - $Skipped)
47-
[int]$Elapsed = $StopWatch.Elapsed.TotalSeconds
48-
"✔️ Installation of $Installed basic apps ($Skipped skipped) took $Elapsed sec"
48+
[int]$numInstalled = ($numEntries - $numSkipped)
49+
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
50+
"✔️ Installed $numInstalled basic apps ($numSkipped skipped) in $elapsed sec."
4951
exit 0 # success
5052
} catch {
5153
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"

0 commit comments

Comments
 (0)