IDG logo

Advertise with InfoWorld


.
 
SiteMap News Test Center Opinions Forums Careers Stock Quote Subject Indexes About Us Search Subscribe Home [Window Manager]

August 12, 1996

Write any lines into the Registry upon start-up: reader enhancements

Readers of my column are always looking for new and better ways of doing things with Windows. Some of my best columns originate with the findings you share with me. This column is the result of just such a discovery -- it describes a way to do something by using a method that differs from what I originally described.

This trick involves the Windows 95 Registry. Among other things, the Registry controls one of Windows 95's "adaptive" behaviors. This behavior involves the words "Shortcut to" that Windows tacks onto any shortcut that you create on the Windows desktop.

Typically, if you right-drag a file from an Explorer window to your desktop, Windows creates an icon for it with an icon title such as "Shortcut to Filename.ext." Oddly, if you delete just the words "Shortcut to" from five or six of these objects, Windows stops tacking on the words when you create new shortcuts.

In my May 20 column (see "You can stamp out the `Shortcut to' link in Windows 95"), I explained this behavior. What's happening is that the Registry is maintaining a variable called "link." The default value for link is 20 (15 hexadecimal). When you create a shortcut on the desktop, the value of link is increased by 1. When you remove the words "Shortcut to" from a shortcut, the value is decreased by 5. Therefore, five or six deletions are usually enough to set link to 0, halting the unwanted prefixed words.

Like Version 1.0 of many of Microsoft's efforts, however, this first shot at adaptive behavior has a serious bug. When you restart Windows, the value of link is reset to 20. Windows "unlearns" the behavior you taught it and starts tacking on "Shortcut to" all over again. Editing the value of link with RegEdit, therefore, is pointless, because you would have to perform the surgery every time you start Windows, which is more work than just deleting the dang words themselves.

By itself, this one flawed adaptive behavior isn't very important. But reader Brad Doster suggests a free fix that you may be able to apply to a lot of other Windows behaviors.

In my May 20 column, I recommended using a Microsoft applet called TweakUI to modify the "Shortcut to" behavior. After you install TweakUI, you run it from the Control Panel. One of TweakUI's tabs provides a setting to turn off "Shortcut to." You can download TweakUI, one of Microsoft's so-called PowerToys, by setting your Internet browser to http://www.microsoft.com/windows/software/powertoy.htm.

But what if you don't have a modem? What if you don't have an Internet account? What if you'd just like to know a powerful technique that allows you to make changes in the Registry automatically and without downloading any software at all?

Doster proposes that you place a three-line text file in your StartUp group. By naming this file LINK.REG, you cause its contents to be merged into the Registry every time you start Windows. (The default behavior for a .REG file is Merge.) In Notepad, type the following, with the keys in brackets all on one line:

REGEDIT4

[HKEY_CURRENT_USER\Software\Microsoft\Windows\
CurrentVersion\Explorer] "link"=hex:00,00,00,00

With LINK.REG in StartUp, the value of link is set back to 0 at the beginning of each Windows session.

This technique has wide application. For example, if you run Windows trainings, you can write a .REG file to reset certain Control Panel settings that students may have changed during your classes.

Specifically, if you plan to make changes to WordPad settings, you might look at the following branch of the Registry:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\
CurrentVersion\Applets\WordPad]

By selecting this branch and then clicking Registry, Export Registry File from the main menu of RegEdit, you can save a text file containing all WordPad settings. (Name the file WordPad, and RegEdit will automatically create a text file called WordPad.reg.) This file will include the preferences you wish to use when viewing different file types, such as Word, RTF, and so forth.

After your training students have changed the WordPad setting to their hearts' content, double-click WordPad.reg -- or replace it in the StartUp group to run automatically -- and the original settings will be restored.

This procedure is not a panacea. You can't remove lines that have been somehow written into the Registry in this way, for example. And it's not a good method for backing up and restoring your Registry. If you want a backup of the Registry for a rainy day, save a copy of the files System.da0 and User.da0 from your Windows folder to a floppy or tape (or, better yet, do a complete backup).

After a .REG file is run (manually or by the StartUp folder), Windows displays a dialog box saying the merge was successful. You can get rid of this dialog box with the RtvReco utility described in my July 15 column. (See "Exile maddening dialog boxes and buttons for good".) RtvReco is available at http://www.infoworld.com/pageone/opinions/livingst/rtvreco.zip.

I'd like to thank Doster for suggesting the use of the StartUp folder in this way. He receives a free copy of Windows 95 Secrets.


Brian Livingston is the coauthor of the new Windows 95 Secrets and author of three other Windows books (IDG Books). Send tips to brian_livingston@infoworld.com or fax: (206) 282-1248.

Missed a column? Go back for more.


Copyright © 1996 by InfoWorld Publishing Company








HOME | NEWS | TEST CENTER | OPINIONS | FORUMS | CAREERS | STOCK QUOTE
SUBJECT INDEXES | SUBSCRIBE | ABOUT US | SEARCH

Copyright © 2002. InfoWorld Media Group, Inc.
InfoWorld.com is a member of IDG.net

InfoWorld.com complies with the ASME guidelines with IDG extensions For New media.