Koba
Koba

Reputation: 11

Use PowerShell to merge .reg file with Windows registry

Running any of the below commands doesn't produce the intended result of showing the navigation pane in Windows Explorer.

GUI way that works: Right-click on the .reg file and select Merge. If prompted by UAC, click on Yes. Click on Yes to confirm that you want to add the registry keys.

Contents of shownavigationpane.reg: Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Modules\GlobalSettings\Sizer] "PageSpaceControlSizer"=hex:a0,00,00,00,01,00,00,00,00,00,00,00,56,05,00,00

I've tried the below 5 PowerShell commands seperatly preceded by Set-ExecutionPolicy unrestricted and none of them have produced the intended result. I have ran the commands with Windows explorer closed.

  1. reg import c:\ps\shownavigationpane.reg

  2. start-process reg -ArgumentList "import C:\temp\shownavigationpane.reg"

  3. regedit /s "C:\temp\shownavigationpane.reg"

  4. Invoke-Command -ScriptBlock {reg import c:\temp\shownavigationpane.reg}

  5. Start-Process -filepath "C:\windows\regedit.exe" -argumentlist "/s c:\temp\shownavigationpane.reg"

Upvotes: 1

Views: 7400

Answers (1)

Theo
Theo

Reputation: 61028

I agree with jrider's comment but like to offer an alternative solution

If that is the only setting you would like to change in the registry, you can do this straight from within PowerShell:

$regPath = 'Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Modules\GlobalSettings\Sizer'
# if that registry path does not already exist, create it here
$null = New-Item -Path $regPath -Force

$values = [byte[]](0xa0, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x05, 0x00, 0x00)
Set-ItemProperty -Path $regPath -Name 'PageSpaceControlSizer' -Value $values -Type Binary -Force

Upvotes: 2

Related Questions