fix: handle empty args in Start-Detached

This commit is contained in:
tian 2026-07-20 14:13:49 +08:00
parent af7447ccad
commit 33fadd17bd

View File

@ -42,7 +42,11 @@ function Start-Detached {
return $null
}
Write-Host " [START] $Name" -ForegroundColor Green
$proc = Start-Process -FilePath $Exe -ArgumentList $Args -WindowStyle Minimized -PassThru
if ($Args -and $Args.Count -gt 0) {
$proc = Start-Process -FilePath $Exe -ArgumentList $Args -WindowStyle Minimized -PassThru
} else {
$proc = Start-Process -FilePath $Exe -WindowStyle Minimized -PassThru
}
Start-Sleep -Milliseconds 500
return $proc
}