Windows: Open Registry Editor regedit.exe at a given key

Hi,

regedit.exe does not accept any command line parameters for opening a given key.

With this hack it does 🙂 Simply set the last opened key to your key.

Create a batch file openreg.cmd

@echo off
if %1=="" exit /b 1
set OPEN_REGKEY=Computer\%1
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\ /v Lastkey /d %OPEN_REGKEY%  /t REG_SZ /f
regedit
[shell]

Try it. Importend: You have to set a "Computer\" in front of your key, because regedit could also open keys on other computers.
[shell]
c:\> openreg.cmd "Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT"

Michael

Leave a Reply