If you wish to open Regedit.exe at a specific key:
1. Create a RegKey.bat file that contains:
@echo off setlocal if \{%1\}2. There are 3 ways to use RegKey.bat:\{\} goto prompt set key=%1 if \{^%key:~0,1%\}
\{^"\} goto open set key="%key%" :open if /i \{^%key:~0,5%\}\{^"HKLM\} set key=%key:"HKLM="HKEY_LOCAL_MACHINE%&goto get if /i \{^%key:~0,5%\}
\{^"HKCU\} set key=%key:"HKCU="HKEY_CURRENT_USER%&goto get if /i \{^%key:~0,5%\}\{^"HKCR\} set key=%key:"HKCR="HKEY_CLASSES_ROOT%&goto get if /i \{^%key:~0,4%\}
\{^"HKU\} set key=%key:"HKU="HKEY_USERS%&goto get if /i \{^%key:~0,5%\}\{^"HKCC\} set key=%key:"HKCC="HKEY_CURRENT_CONFIG% :get if /i \{^%key:~0,30%\}
\{^"HKEY_LOCAL_MACHINE\System\CCS\} set key=%key:"HKEY_LOCAL_MACHINE\SYSTEM\CCS="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet% set regedt=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit reg.exe ADD %regedt% /v LastKey /d %key% /f>nul 2>&1 if NOT %ERRORLEVEL% EQU 0 @echo %regedt% NOT found. endlocal start regedit.exe goto :EOF :prompt set /p key=Enter the key to open. if \{^%key:~0,1%\}==\{^"\} goto open set key="%key%" goto open
A.1. Create a shortcut to the RegKey.bat file.
A.2. Set the icon of this shortcut to Regedit.exe.
A.3. Set it to run in a normal window.
A.4. Double-click the icon and enter the key or "".
B.1. Start / Run / RegKey <The Key> / OK or
B.2. Start / Run / RegKey "" / OK.
C.1. Open a CMD prompt.
C.2. Type RegKey <The Key> and press Enter or
C.3. Type RegKey "" and press Enter.
NOTE: Reg.exe is from the Windows 2000 Support Tools or the Reg.exe that is built into Windows XP and later.
NOTE If you implemented tip 2358, How do I prevent Regedit from using the last state, you must undo the permissions change.
NOTE: You could also implement tip 6200, How do I prevent Regedit from remembering the last key, without altering registry permissions, and use it instead of RegKey "".
NOTE: I have implemented the following abbreviations that you can use:
Abbreviation | Key |
HKLM | HKEY_LOCAL_MACHINE |
HKLM\SYSTEM\CCS | HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet |
HKCU | HKEY_CURRENT_USER |
HKCR | HKEY_CLASSES_ROOT |
HKCC | HKEY_CURRENT_CONFIG |