作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有没有人写过一些 delphi 代码来实现 REGJUMP是吗?
具体来说,REGJUMP 是一款 MS 应用程序,可让您打开 regedit 到指定的值/键路径(准备在 regedit 中查看或编辑)。例如:regjump HKLM\Software\Microsoft\Windows 将在路径 HKLM\Software\Microsoft\Windows 中打开 regedit。
我尝试过:
ShellExecute(handle,'Open','C:\WINDOWS\regedit.exe', nil, nil, SW_SHOW);
这当然只会打开 regedit 到您最后查看的路径。
我尝试过:
ShellExecute(handle,'Open','C:\WINDOWS\regedit.exe', '[HKLM\Software\Microsoft\Windows]', nil, SW_SHOW);
但是尝试将值导入到路径中 - 由于各种原因惨败 - 并且这不是我想要做的。
最佳答案
我想你会发现Regedit中最后访问的注册表项保存在注册表中LastKey
值下
HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\RegEdit
至少在 Windows10 中。
因此,我会尝试在调用 ShellExecute 或其他方法之前写入我想要访问的值。
示例代码:
program RegJumpTest;
{$APPTYPE CONSOLE}
uses
SysUtils, Registry;
var
Reg : TRegistry;
LastKey,
KeyToFind,
ValueToWrite : String;
begin
ValueToWrite := ParamStr(1);
KeyToFind := 'SOFTWARE\Microsoft\Windows\CurrentVersion\Applets\Regedit';
Reg := TRegistry.Create;
if Reg.KeyExists(KeyToFind) then
writeln('found ', KeyToFind)
else
writeln('not found ', KeyToFind);
if Reg.OpenKey(KeyToFind, False) then
writeln(KeyToFind, ' opened ok')
else begin
writeln('failed to open key: ', KeyToFind);
Halt(1);
end;
LastKey := Reg.ReadString('LastKey');
writeln('Last key: >', LastKey, '<');
Reg.WriteString('LastKey', ValueToWrite);
readln;
end.
关于delphi - 有没有人写过一些 delphi 代码来实现 REGJUMP 的功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41630488/
有没有人写过一些 delphi 代码来实现 REGJUMP是吗? 具体来说,REGJUMP 是一款 MS 应用程序,可让您打开 regedit 到指定的值/键路径(准备在 regedit 中查看或编辑
我是一名优秀的程序员,十分优秀!