How to Open Selected Registry Address from Internet Explorer into Regedit

How to Open Selected Registry Address from Internet Explorer into Regedit

Adding a function in the context menu is quite easy.

You noticed that many apps offer some context menu facilities, to do so they mainly use an activex/addon installed with their program.

An IE context menu item is usually linked to a htm/html file wich includes scripts, links to activex, etc... and use a personalized dll.

In fact we have to write a script, embed it or name it as a htm file and ask the registry to write an entry in the context menu which on click links to the htm file.

Due to UAC, the htm file will ask to open a VBS file which will do the job.
A prompt will ask you if you accept to run the script.
Personally i place the htm file in the common files folder where i created a folder named "Registry" just to remember it better, but it could be anywhere.
The VBS file should be in %windir% so that it can be called from anywhere.
Then, the last thing to do is to add the registry key which will modifiy the IE context menu.


The added context menu items are in:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\



OPTION ONE:
1/ We will start by the htm file:

We want to add in the context menu an item which when clicked opens Regedit at a selected Address.
So we have to make a script which copy the selected Address into the clipboard.



Code:
<SCRIPT>
var CheckForSelection = window.external.menuArguments.document.selection.createRange().text;
window.clipboardData.setData("Text",CheckForSelection);
</SCRIPT>
Well, now we have to run a vbs script which will do the rest of the job.
We will call this VBScript OpenReg, we will make it after this step.



Code:
<SCRIPT LANGUAGE="VBScript">
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "%windir%\OpenReg.vbs",1,False
Set WshShell = Nothing
</SCRIPT>
We just copy these 2 scripts above in notepad and save as OpenReg.htm in: C:\Program Files\Common Files\Registry


2/ It is time now to make the script which will open Regedit at the selected address.


Code:
Set oSh = CreateObject("WScript.Shell")
Set oHtml = CreateObject("htmlfile")
Set oClipBoard = oHtml.ParentWindow.ClipBoardData
Set Shell = WScript.CreateObject("WScript.Shell")
strText = oClipBoard.getData("Text")
Set WshShell = CreateObject("WScript.Shell")
Dim Cle
Cle = "Computer\" & strText
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\Lastkey",Cle,"REG_SZ"
WshShell.Run "regedit", 1,True
Set WshShell = Nothing
We just copy these lines above in notepad and save as OpenReg.vbs in: C:\Windows


3/ To finish, we write the new key in the registry.

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\

Create a new key named: Open In Regedit and give as default value: File://C:\Program Files\Common Files\Registry\OpenReg.htm

Close Regedit, open IE and test. (select a registry address, right click and "Open in Regedit").


OPTION TWO:
If you are as lazy as i am, all files are in the attached zip file.



Openinreg.zip < Click To Download
  • Extract OpenReg.htm to C:\Program Files\Common Files\Registry
  • Extract OpenReg.vbs to C:\Windows
  • Run openinreg.reg to write the context menu key in the registry
 

Attachments

  • Regedit.png
    Regedit.png
    7 KB · Views: 293
Last edited by a moderator:
Back
Top