Add quotes to DISM file paths

Co-authored-by: CodingWonders <101426328+CodingWonders@users.noreply.github.com>
This commit is contained in:
Nilesh 2025-04-02 21:56:22 +05:30 committed by GitHub
parent 34e0988cd4
commit 6fa9d3cdd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,11 +65,11 @@ public class PowerManagement {
Write-Host "Exporting Windows image to a WIM file, keeping the index we want to work on. This can take several minutes, depending on the performance of your computer..."
try {
# Try ps command first
Export-WindowsImage -SourceImagePath $mountDir\sources\install.esd -SourceIndex $index -DestinationImagePath $mountDir\sources\install.wim -CompressionType "Max"
Export-WindowsImage -SourceImagePath "$mountDir\sources\install.esd" -SourceIndex $index -DestinationImagePath "$mountDir\sources\install.wim" -CompressionType "Max"
} catch {
# Fallback to DISM command
Write-Host "Export-WindowsImage failed, using DISM instead..."
dism /Export-Image /SourceImageFile:$mountDir\sources\install.esd /SourceIndex:$index /DestinationImageFile:$mountDir\sources\install.wim /Compress:max
dism /Export-Image /SourceImageFile:"$mountDir\sources\install.esd" /SourceIndex:$index /DestinationImageFile:"$mountDir\sources\install.wim" /Compress:max
}
if ($?) {
Remove-Item -Path "$mountDir\sources\install.esd" -Force