Fix encoding of app association file

This commit is contained in:
Manuel Thalmann 2023-07-26 14:49:03 +02:00
parent 7cf1d9c599
commit b4d4e6d10f

View file

@ -30,7 +30,11 @@ $null = New-Module {
$association.ApplicationName = $applicationName; $association.ApplicationName = $applicationName;
$configFile = New-TemporaryFile; $configFile = New-TemporaryFile;
$associations.Save($configFile.FullName); $writerSettings = [System.Xml.XmlWriterSettings]::new();
$writerSettings.Indent = $true;
$writerSettings.Encoding = [System.Text.UTF8Encoding]::new();
$writer = [System.Xml.XmlWriter]::Create($configFile.FullName, $writerSettings);
$associations.Save($writer);
DISM /Online "/Import-DefaultAppAssociations:$($configFile.FullName)"; DISM /Online "/Import-DefaultAppAssociations:$($configFile.FullName)";
Remove-Item $configFile; Remove-Item $configFile;
} }