My original goal was to have the Windows Registry Editor open up at a specific key. We tenuously accomplished that. However now there there is a new problem.
The Windows Registry remembers which key was open so it'll show it by default the next time it is opened here:
Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Applets\Regedit
Using the LastKey key.
In the command prompt reg /? doesn't help, as it turns out we have to use reg add /? for the syntax help. So I took Neil's example and modified it to the following (test.bat):
REG ADD HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Applets\Regedit /v LastKey /t REG_EXPAND_SZ /d "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer" /f
regedit
Now the /f surpresses the confirmation and the value is actually set. The batch program opens the Windows Registry too. The problem is that the Windows Registry just opens up at just Computer.
How do we identify and correct the problem of the Registry no longer utilizing LastKey to automatically open it via the batch file?
For clarification: if I manually go to another key, close the Registry Editor and then open it again manually it will honor LastKey setting. So this issue is, as far as I can determine, specific to the batch program.
Additionally I've started the string with both (which neither works):
HKEY_CURRENT_USER\SOFTWARE\Microsoft\WindowsComputer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows