From f1595cd91efbea595b2383cfdefd285df3485505 Mon Sep 17 00:00:00 2001 From: Raphire <9938813+Raphire@users.noreply.github.com> Date: Sun, 28 Sep 2025 18:21:14 +0200 Subject: [PATCH] Fix displayed app count in script output when removing apps --- Win11Debloat.ps1 | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Win11Debloat.ps1 b/Win11Debloat.ps1 index a21fac6..d30ec4e 100644 --- a/Win11Debloat.ps1 +++ b/Win11Debloat.ps1 @@ -826,7 +826,8 @@ function PrintFromFile { function PrintAppsList { param ( - $path + $path, + $printCount = $false ) if (-not (Test-Path $path)) { @@ -834,6 +835,11 @@ function PrintAppsList { } $appsList = ReadAppslistFromFile $path + + if ($printCount) { + Write-Output "- Remove $($appsList.Count) apps:" + } + Write-Host $appsList -ForegroundColor DarkGray } @@ -1572,7 +1578,7 @@ if ((-not $script:Params.Count) -or $RunDefaults -or $RunDefaultsLite -or $RunSa PrintAppsList "$PSScriptRoot/Appslist.txt" } '2' { - AddParameter 'RemoveAppsCustom' 'Remove $($script:SelectedApps.Count) apps:' $false + AddParameter 'RemoveAppsCustom' "Remove $($script:SelectedApps.Count) apps:" $false PrintAppsList "$PSScriptRoot/CustomAppsList" } } @@ -1656,11 +1662,16 @@ if ((-not $script:Params.Count) -or $RunDefaults -or $RunDefaultsLite -or $RunSa $parameterName = $line.Substring(0, $line.IndexOf('#')) # Print parameter description and add parameter to Params list - if ($parameterName -eq "RemoveAppsCustom") { - PrintAppsList "$PSScriptRoot/CustomAppsList" - } - else { - Write-Output $line.Substring(($line.IndexOf('#') + 1), ($line.Length - $line.IndexOf('#') - 1)) + switch ($parameterName) { + 'RemoveApps' { + PrintAppsList "$PSScriptRoot/Appslist.txt" $true + } + 'RemoveAppsCustom' { + PrintAppsList "$PSScriptRoot/CustomAppsList" $true + } + default { + Write-Output $line.Substring(($line.IndexOf('#') + 1), ($line.Length - $line.IndexOf('#') - 1)) + } } if (-not $script:Params.ContainsKey($parameterName)) {