Recipe 9.10. Creating a Registry LinkProblemYou want to create a link from one registry key to another. Registry links are used extensively by the operating system, but most people aren't aware that they exist and that they can even be created manually. SolutionUsing a command-line interfaceRegistry links have never been a highly publicized feature and as a result, there are very few tools that can create them. You can download a tool called regln from http://www.ntinternals.net/regln/ to do the job. This is how you create a registry link with it: > regln <LinkKeyName> <CurrentKeyName> For example: > regln HKLM\SOFTWARE\Rallencorp\Current HKLM\SOFTWARE\Rallencorp\Settings1 Use the -d switch to delete a registry link: > regln -d <LinkKeyName> For example: > regln -d HKLM\SOFTWARE\Rallencorp\Current Using VBScriptThe StdRegProv WMI Provider does not support creating registry links, so you'll need to shell out to regln if you want to create them in a script. DiscussionYou have undoubtedly created a shortcut to a file or folder, perhaps on your desktop, at one point or another. Shortcuts are useful if you have a file that is nested deeply within the filesystem and you don't want to navigate to it each time to access it. Think of registry links in the same way. If there are deeply nested registry keys you need to access on a regular basis, you can use a registry link to make it easier to reach. Let's say there are a bunch of keys I frequently access that are contained somewhere under the HKEY_LOCAL_MACHINE\Software key. What I could do is create a key called HKEY_LOCAL_MACHINE\Software\Rallencorp and then put all of my registry links under it. Here is an example of creating a link to the Run key: regln HKLM\Software\Rallencorp\Run HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run See AlsoMore information about the regln command can be found at http://www.tenox.tc/out/regln.txt. |