XTL*_*XTL 39 command-line regedit
如何使用某个路径启动Windows'RegEdit,如" HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0",这样我就不必点击了?
执行此操作的命令行参数是什么?或者有没有地方可以找到RegEdit开关的解释?
Chr*_*ruk 30
Mark Russinovich 有一个名为RegJump的程序,可以满足您的需求.它将启动regedit并将其从命令行移动到您想要的密钥.
RegJump使用(或至少用于)在每次调用时使用相同的regedit窗口,因此如果你想打开多个regedit会话,除了RegJump采用的那个之外,你仍然需要以老式的方式做事.无论如何,这是一个小小的警告,但要注意一个.
小智 27
使用以下批处理文件(添加到filename.bat):
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit /v LastKey /t REG_SZ /d Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Veritas\NetBackup\CurrentVersion\Config /f
START regedit
Run Code Online (Sandbox Code Playgroud)
取代:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Veritas\NetBackup\CurrentVersion\Config
Run Code Online (Sandbox Code Playgroud)
使用您的注册表路径.
小智 5
来自http://windowsxp.mvps.org/jumpreg.htm(我还没有尝试过这些):
当您启动Regedit时,它会自动打开查看的最后一个键.(Windows XP中的注册表编辑器将最后查看的注册表项保存在单独的位置).如果您希望直接跳转到特定注册表项而不手动导航路径,则可以使用这些方法/工具中的任何一种.
选项1
使用VBScript:将这些行复制到记事本文档,另存为registry.vbs
'Launches Registry Editor with the chosen branch open automatically
'Author : Ramesh Srinivasan
'Website: http://windowsxp.mvps.org
Set WshShell = CreateObject("WScript.Shell")
Dim MyKey
MyKey = Inputbox("Type the Registry path")
MyKey = "My Computer\" & MyKey
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\Lastkey",MyKey,"REG_SZ"
WshShell.Run "regedit", 1,True
Set WshShell = Nothing
Run Code Online (Sandbox Code Playgroud)
双击Registry.vbs,然后键入要打开的完整注册表路径.
例: HKEY_CLASSES_ROOT\.MP3
限制:如果Regedit已经打开,则上述方法无效.
注意:对于Windows 7,您需要MyKey = "My Computer\" & MyKey用MyKey = "Computer\" & MyKey(替换字符串My)替换该行.对于德语Windows XP,"My Computer\"必须将该字符串替换为"Arbeitsplatz\".
选项2
来自Sysinternals.com的Regjump
这个小命令行小程序采用注册表路径并使Regedit对该路径开放.它接受标准的根密钥(例如HKEY_LOCAL_MACHINE)和缩写形式(例如HKLM).
用法:regjump [路径]
例: C:\Regjump HKEY_CLASSES_ROOT\.mp3
选项3
12Ghosts JumpReg来自12ghosts.com
从托盘图标跳转到注册表项!这是一个非常有用的工具.您可以管理并直接跳转到经常访问的注册表项.无限的列表大小,跳转到键和值,一键获取当前键,跳转到剪贴板中的键,跳转到HKCU或HKLM中的键.在易于使用的托盘图标菜单中使用注释管理和排序键.创建注册表项的快捷方式.
与此处发布的其他批处理解决方案相比,这是又一个批处理文件解决方案,具有多项增强功能。
它还设置LastKey由Regedit本身在每次退出时更新的字符串值,以在启动后显示与上次退出时相同的键。
@echo off
setlocal EnableExtensions DisableDelayedExpansion
set "RootName=Computer"
set "RegKey=%~1"
if defined RegKey goto PrepareKey
echo/
echo Please enter the path of the registry key to open.
echo/
set "RegKey="
set /P "RegKey=Key path: "
rem Exit batch file without starting Regedit if nothing entered by user.
if not defined RegKey goto EndBatch
:PrepareKey
rem Remove double quotes and square brackets from entered key path.
set "RegKey=%RegKey:"=%"
if not defined RegKey goto EndBatch
set "RegKey=%RegKey:[=%"
if not defined RegKey goto EndBatch
set "RegKey=%RegKey:]=%"
if not defined RegKey goto EndBatch
rem Replace hive name abbreviation by appropriate long name.
set "Abbreviation=%RegKey:~0,4%"
if /I "%Abbreviation%" == "HKCC" set "RegKey=HKEY_CURRENT_CONFIG%RegKey:~4%" & goto GetRootName
if /I "%Abbreviation%" == "HKCR" set "RegKey=HKEY_CLASSES_ROOT%RegKey:~4%" & goto GetRootName
if /I "%Abbreviation%" == "HKCU" set "RegKey=HKEY_CURRENT_USER%RegKey:~4%" & goto GetRootName
if /I "%Abbreviation%" == "HKLM" set "RegKey=HKEY_LOCAL_MACHINE%RegKey:~4%" & goto GetRootName
if /I "%RegKey:~0,3%" == "HKU" set "RegKey=HKEY_USERS%RegKey:~3%"
:GetRootName
rem Try to determine automatically name of registry root.
if not exist %SystemRoot%\Sysnative\reg.exe (set "RegEXE=%SystemRoot%\System32\reg.exe") else set "RegEXE=%SystemRoot%\Sysnative\reg.exe"
for /F "skip=2 tokens=1,2*" %%K in ('%RegEXE% QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit" /v "LastKey"') do if /I "%%K" == "LastKey" for /F "delims=\" %%N in ("%%M") do set "RootName=%%N"
rem Is Regedit already running?
%SystemRoot%\System32\tasklist.exe /NH /FI "IMAGENAME eq regedit.exe" | %SystemRoot%\System32\findstr.exe /B /I /L regedit.exe >nul || goto SetRegPath
echo/
echo Regedit is already running. Path can be set only when Regedit is not running.
echo/
set "UserChoice=N"
set /P "UserChoice=Terminate Regedit (y/N): "
if /I "%UserChoice:"=%" == "y" %SystemRoot%\System32\taskkill.exe /IM regedit.exe >nul 2>nul & goto SetRegPath
echo Switch to running instance of Regedit without setting entered path.
goto StartRegedit
:SetRegPath
rem Add this key as last key to registry for Regedit.
%RegEXE% ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit" /v "LastKey" /d "%RootName%\%RegKey%" /f >nul 2>nul
:StartRegedit
if not exist %SystemRoot%\Sysnative\cmd.exe (start %SystemRoot%\regedit.exe) else %SystemRoot%\Sysnative\cmd.exe /D /C start %SystemRoot%\regedit.exe
:EndBatch
endlocal
Run Code Online (Sandbox Code Playgroud)
增强功能是:
注册表路径也可以作为命令行参数传递给批处理脚本。
可以输入或粘贴注册表路径,带或不带双引号。
注册表路径可以输入、粘贴或作为参数传递,带或不带方括号。
注册表路径可以输入、粘贴或作为参数传递,也可以使用缩写的配置单元名称 ( HKCC, HKCU, HKCR, HKLM, HKU)。
批处理脚本检查是否已在运行Regedit ,因为在Regedit已运行时启动Regedit时不会显示注册表项。系统会询问批处理用户是否应终止正在运行的实例以重新启动它以显示输入的注册表路径。如果批处理用户选择不终止Regedit的所有实例,则在不设置输入路径的情况下启动Regedit,导致(通常)只是将Regedit窗口置于前台。
该批处理文件尝试自动获取注册表根的名称,该名称位于英语 Windows XP我的电脑、德语 Windows XP、Arbeitsplatz以及 Windows 7 和更高版本的 Windows just Computer上。如果注册表中RegeditLastKey的值缺失或为空,则此操作可能会失败。对于这种情况,请在批处理代码的第三行中设置正确的根名称。
批处理文件在 64 位 Windows 上运行,即使在 64 位 Windows 上由 32 位处理批处理文件,也始终在 64 位执行环境中进行Regedit ,这对于受 WOW64 影响的注册表项%SystemRoot%\SysWOW64\cmd.exe很重要。
| 归档时间: |
|
| 查看次数: |
54699 次 |
| 最近记录: |