每次打开注册表,所打开的路径都是上次打开注册表最后停留的路径,而这个路径保存在 HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit 的 LastKey 下,所以可以利用这点来实现
注册表定位 —— 即打开注册表前修改那个键值为我们想要定位的路径。
示例:
@echo off
set /p key=请输入完整路径(根目录不能缩写):
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit /v LastKey /d "%key%" /f
start regedit
当然这种方法在注册表已经打开的情况下无效(除非先关闭注册表再...)
------------------------------------------------------------------------------------------------------
命令行工具推荐 nircmd,可以精确定位到“项”:
regedit
Opens RegEdit with the specified key/value.
Examples:
regedit "HKLM\Software\Microsoft\Windows\CurrentVersion" "CommonFilesDir"
regedit "HKEY_CURRENT_USER\Control Panel\Desktop" "Wallpaper"
Last edited by tireless on 2008-12-16 at 11:19 ]