How to access the 64-bit registry from a 32-bit Powershell instance?

后端 未结 8 1190
北荒
北荒 2020-12-06 09:54

If you launch a 32-bit instance of Powershell (%SystemRoot%\\syswow64\\WindowsPowerShell\\v1.0\\powershell.exe), then the registry provider only sees the limited 32-bit part

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-06 10:44

    The REG.EXE command can write to 64-bit registries so the below should be safe for 32/64-bit from powershell.

    ®.EXE @('ADD','HKLM\YOURPATH\...','/v','KEY','/t','REG_DWORD','/d','12c','/f','/reg:64')
    

    Seems quite a bit simpler and less error prone than the other solutions. This may have came out years after mind you.

提交回复
热议问题