Minimize Win11Debloat powershell window when not running CLI mode

This commit is contained in:
Raphire
2026-02-01 13:37:27 +01:00
parent 98fce954f0
commit c6e3edbe40

View File

@@ -140,8 +140,15 @@ $arguments = $($PSBoundParameters.GetEnumerator() | ForEach-Object {
Write-Output "" Write-Output ""
Write-Output "> Running Win11Debloat..." Write-Output "> Running Win11Debloat..."
# Minimize the powershell window when CLI is not specified
if (-not $CLI) {
$windowStyle = "Minimized"
} else {
$windowStyle = "Normal"
}
# Run Win11Debloat script with the provided arguments # Run Win11Debloat script with the provided arguments
$debloatProcess = Start-Process powershell.exe -PassThru -ArgumentList "-executionpolicy bypass -File $env:TEMP\Win11Debloat\Win11Debloat.ps1 $arguments" -Verb RunAs $debloatProcess = Start-Process powershell.exe -WindowStyle $windowStyle -PassThru -ArgumentList "-executionpolicy bypass -File $env:TEMP\Win11Debloat\Win11Debloat.ps1 $arguments" -Verb RunAs
# Wait for the process to finish before continuing # Wait for the process to finish before continuing
if ($null -ne $debloatProcess) { if ($null -ne $debloatProcess) {