From e58df8018144007598ce48d0db4d09bb1db803f7 Mon Sep 17 00:00:00 2001 From: Julian Freeman Date: Sat, 6 Dec 2025 07:27:04 -0400 Subject: [PATCH] add Enabled --- config/apps.json => apps.json | 8 ++++++++ main.ps1 | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) rename config/apps.json => apps.json (94%) diff --git a/config/apps.json b/apps.json similarity index 94% rename from config/apps.json rename to apps.json index 68fd128..fc7229c 100644 --- a/config/apps.json +++ b/apps.json @@ -3,6 +3,7 @@ "Name": "7-Zip", "Id": "7zip.7zip", "Version": "", + "Enabled": 1, "PostInstall": [ { "Type": "Command", @@ -15,6 +16,7 @@ "Name": "Google Chrome", "Id": "Google.Chrome", "Version": "", + "Enabled": 1, "PostInstall": [ { "Type": "RegImport", @@ -26,6 +28,7 @@ "Name": "OpenOffice", "Id": "Apache.OpenOffice", "Version": "4.116.9816", + "Enabled": 1, "PostInstall": [ { "Type": "Command", @@ -48,6 +51,7 @@ "Name": "KeePassXC", "Id": "KeePassXCTeam.KeePassXC", "Version": "2.6.6", + "Enabled": 1, "PostInstall": [ { "Type": "FileCopy", @@ -60,6 +64,7 @@ "Name": "VeraCrypt", "Id": "IDRIX.VeraCrypt", "Version": "1.26.20", + "Enabled": 1, "PostInstall": [ { "Type": "FileCopy", @@ -72,12 +77,14 @@ "Name": "File Shredder", "Id": "PowTools.FileShredder", "Version": "", + "Enabled": 1, "PostInstall": [] }, { "Name": "VLC", "Id": "VideoLAN.VLC", "Version": "", + "Enabled": 1, "PostInstall": [ { "Type": "FileCopy", @@ -94,6 +101,7 @@ "Name": "Adobe Acrobat Reader", "Id": "Adobe.Acrobat.Reader.64-bit", "Version": "", + "Enabled": 0, "PostInstall": [ { "Type": "RegImport", diff --git a/main.ps1 b/main.ps1 index e158c44..d0a2f96 100644 --- a/main.ps1 +++ b/main.ps1 @@ -10,7 +10,7 @@ if (-not (Test-Path "$PSScriptRoot\lib")) { } # === 2. 读取配置 === -$jsonPath = "$PSScriptRoot\config\apps.json" +$jsonPath = "$PSScriptRoot\apps.json" if (-not (Test-Path $jsonPath)) { Write-Error "Cannot find: $jsonPath" exit 1 @@ -22,6 +22,11 @@ $apps = Get-Content $jsonPath -Encoding UTF8 | ConvertFrom-Json # === 3. 主循环 === foreach ($app in $apps) { + if ($app.Enabled -ne 1) { + Write-Host "[Skipping] $($app.Name)" -ForegroundColor DarkGray + continue # 立即结束本次循环,进入下一个软件 + } + Write-Host "`n==========================================" -ForegroundColor Cyan Write-Host "Installing: $($app.Name)" -ForegroundColor Yellow Write-Host "=========================================="