Fix Print?

This commit is contained in:
Dandaedre 2026-09-04 13:11:01 +02:00
parent f405235980
commit 2520b18ebe
1 changed files with 10 additions and 5 deletions

View File

@ -114,11 +114,17 @@ function Write-Section {
Write-Both $Writer $separator
try {
& $Script 2>&1 | ForEach-Object {
$text = ($_ | Out-String -Width 240).TrimEnd()
$result = & $Script 2>&1
$text = $result | Out-String -Width 240
if (-not [string]::IsNullOrWhiteSpace($text)) {
Write-Both $Writer $text
if ([string]::IsNullOrWhiteSpace($text)) {
Write-Both $Writer '(no output)'
}
else {
$lines = $text.TrimEnd() -split "`r?`n"
foreach ($line in $lines) {
Write-Both $Writer $line
}
}
}
@ -126,7 +132,6 @@ function Write-Section {
Write-Both $Writer ('ERROR: ' + $_.Exception.Message)
}
}
function Get-InstalledPrograms {
$paths = @(
'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*',