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


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

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


Advertisment to support

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.