Fix PowerShell string parsing in Backup-GERegistry.ps1
Use string concatenation instead of variable interpolation to avoid PowerShell interpreting KB as a special token. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -176,7 +176,7 @@ foreach ($type in $registryPaths.Keys) {
|
|||||||
if ($success -and (Test-Path $regInfo.OutputFile)) {
|
if ($success -and (Test-Path $regInfo.OutputFile)) {
|
||||||
$fileSize = (Get-Item $regInfo.OutputFile).Length
|
$fileSize = (Get-Item $regInfo.OutputFile).Length
|
||||||
$fileSizeKB = [math]::Round($fileSize / 1KB, 2)
|
$fileSizeKB = [math]::Round($fileSize / 1KB, 2)
|
||||||
Write-ColorOutput " Saved to: $($regInfo.OutputFile) ($fileSizeKB KB)" "Green"
|
Write-ColorOutput (" Saved to: " + $regInfo.OutputFile + " (" + $fileSizeKB + " KB)") "Green"
|
||||||
|
|
||||||
$backupResults += @{
|
$backupResults += @{
|
||||||
Type = $type
|
Type = $type
|
||||||
@@ -240,7 +240,7 @@ if ($mergedCount -gt 0) {
|
|||||||
$fileSize = (Get-Item $combinedFile).Length
|
$fileSize = (Get-Item $combinedFile).Length
|
||||||
$fileSizeKB = [math]::Round($fileSize / 1KB, 2)
|
$fileSizeKB = [math]::Round($fileSize / 1KB, 2)
|
||||||
|
|
||||||
Write-ColorOutput " Combined backup saved: $combinedFile ($fileSizeKB KB)" "Green"
|
Write-ColorOutput (" Combined backup saved: " + $combinedFile + " (" + $fileSizeKB + " KB)") "Green"
|
||||||
|
|
||||||
# Clean up individual files if combined was successful
|
# Clean up individual files if combined was successful
|
||||||
foreach ($result in $backupResults | Where-Object { $_.Success }) {
|
foreach ($result in $backupResults | Where-Object { $_.Success }) {
|
||||||
|
|||||||
Reference in New Issue
Block a user