|
Dim objHTA, cClipboard, WshShell |
|
Set objHTA = createobject("htmlfile") |
|
cClipboard = objHTA.parentwindow.clipboarddata.getdata("text") |
|
|
|
Set WshShell = WScript.CreateObject("WScript.Shell") |
|
Dim MyKey |
|
|
|
If isRegPath(cClipboard,cClipboard) Then |
|
MyKey = Inputbox("Navigate to this Registry path", "Go to reg key...", cClipboard) |
|
Else |
|
MyKey = Inputbox("Type the Registry path", "Go to reg key...") |
|
End If |
|
|
|
If IsEmpty(MyKey) Then |
|
'Cancelled |
|
Else |
|
Call isRegPath(MyKey,MyKey) |
|
MyKey = "Computer\" & MyKey |
|
WshShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\LastKey", MyKey, "REG_SZ" |
|
WshShell.Run "regedit.exe -m" |
|
End If |
|
|
|
Set objHTA = nothing |
|
Set WshShell = nothing |
|
|
|
Function isRegPath(sString,fString) |
|
If IsNull(sString) Then |
|
sString = "" |
|
End If |
|
isRegPath = False |
|
Dim oRegExp, patterns, replacements, item, i, aMatches, match, bFound |
|
patterns = Array("HKEY_", "HKCU:?\\", "HKLM:?\\", "HKU:?\\", "HKCC:?\\", "HKCR:?\\") |
|
replacements = Array("HKEY_", "HKEY_CURRENT_USER\", "HKEY_LOCAL_MACHINE\", "HKEY_USERS\", "HKEY_CURRENT_CONFIG\", "HKEY_CLASSES_ROOT\") |
|
Set oRegExp = New RegExp |
|
oRegExp.IgnoreCase = True |
|
oRegExp.Global = True |
|
Set trailingslash = New RegExp |
|
trailingslash.Pattern = "\\$" |
|
trailingslash.Global = true |
|
|
|
i = 0 |
|
For Each item In patterns |
|
oRegExp.Pattern = item |
|
Set aMatches = oRegExp.Execute(sString) |
|
bFound = False |
|
|
|
For Each match In aMatches |
|
bFound = True |
|
fString = Replace(fString, vbCr, "") |
|
fString = Replace(fString, vbLf, "") |
|
fString = Replace(fString, chr(34), "") |
|
fString = Trim(fString) |
|
fString = trailingslash.Replace(fString, "") |
|
fString = Replace(fString, match, replacements(i)) |
|
Exit For |
|
Next |
|
i = i+1 |
|
|
|
If bFound Then |
|
isRegPath = True |
|
Exit For |
|
Else |
|
isRegPath = False |
|
End If |
|
Next |
|
End Function |
Hello, should this code still work for Windows 10 PRO x64 bit and build 1903 ??
I try it now and it doesn't work for me in any way. And some time ago I used it and everything was correct.