Closed hoang-himself closed 1 month ago
When using powershell in reg, the vertical slash is not properly escaped
reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "UninstallCopilot" /t REG_SZ /d "powershell.exe -NoProfile -Command \"Get-AppxPackage -Name 'Microsoft.Windows.Ai.Copilot.Provider' | Remove-AppxPackage;\"" /f
The vertical slash should be escaped as ^|
^|
reg.exe add "HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\RunOnce" /v "UninstallCopilot" /t REG_SZ /d "powershell.exe -NoProfile -Command \"Get-AppxPackage -Name 'Microsoft.Windows.Ai.Copilot.Provider' ^| Remove-AppxPackage;\"" /f
This one can be hotfixed
https://github.com/cschneegans/unattend-generator/blob/7a577e15c56c859b83825d4d00eafcaa862a28c3/modifier/Bloatware.cs#L201
This will require further testing
https://github.com/cschneegans/unattend-generator/blob/7a577e15c56c859b83825d4d00eafcaa862a28c3/modifier/Optimizations.cs#L117-L119
https://github.com/cschneegans/unattend-generator/blob/7a577e15c56c859b83825d4d00eafcaa862a28c3/Main.cs#L223-L226
^ is the escape character for cmd.exe, and the commands from <RunSynchronousCommand> elements are not run by cmd.exe. If you want to test these commands, use the Run dialog (Windows key+R).
^
cmd.exe
<RunSynchronousCommand>
When using powershell in reg, the vertical slash is not properly escaped
The vertical slash should be escaped as
^|
This one can be hotfixed
https://github.com/cschneegans/unattend-generator/blob/7a577e15c56c859b83825d4d00eafcaa862a28c3/modifier/Bloatware.cs#L201
This will require further testing
https://github.com/cschneegans/unattend-generator/blob/7a577e15c56c859b83825d4d00eafcaa862a28c3/modifier/Optimizations.cs#L117-L119
https://github.com/cschneegans/unattend-generator/blob/7a577e15c56c859b83825d4d00eafcaa862a28c3/Main.cs#L223-L226