August 27th, 2003

Why are these unwanted files/folders opening when I log on?

I get called on frequently to do troubleshooting, so I figure I’d share some entries from my private bag of tricks.  (And there are some remarks for programmers hidden here too.)

Problem 1. A folder like C:\Program Files\LitWare opens each time you log on.

Reason: Your system contains two sibling directories where one is a strict prefix of the second. For example,

C:\Program Files\LitWare
C:\Program Files\LitWare Deluxe

If you go to regedit, you will likely find under

HKEY_LOCAL_MACHINE\Microsoft\Windows\CurrentVersion\Run

or

HKEY_CURRENT_USER\Microsoft\Windows\CurrentVersion\Run

an entry that refers to a program in the longer directory, like

Reminder=REG_SZ:C:\Program Files\LitWare Deluxe\reminder.exe

What’s more, the reference such as the one above will not have quotation marks to protect the embedded spaces in the name.

What’s going on is that LitWare Deluxe wants to run C:\Program Files\LitWare Deluxe\reminder.exe, but due to the spaces, this first gets parsed as

app = C:\Program
command line=Files\LitWare Deluxe\reminder.exe 

This fails, so the system tries again with

app = C:\Program Files\LitWare
command line=Deluxe\reminder.exe 

and this succeeds because you have a folder called C:\Program Files\LitWare. Edit the string and add the quotation marks.

Note to programmers: This is why it’s important to quote your filenames if they contain spaces.

Problem 2. A desktop.ini file opens when you log on.

Reason: The System and Hidden attributes for the file desktop.ini in the directory

C:\Documents and Settings\All Users\Start Menu\Startup

or

C:\Documents and Settings\yourname\Start Menu\Startup

have been lost. Alternatively, you went to the advanced Folder Options and disabled “Hide protected operating system files (Recommended)”.

If a file is marked with both the System and Hidden attributes, Explorer will not enumerate it, thereby hiding it from the user. If you disable “Hide protected operating system files”, then this rule is suppressed.

When you log on, one of the things that Explorer does is enumerate the contents of your Startup folders and runs each file it finds. If the desktop.ini is not marked System+Hidden (or you disabled the rule that filters them out), then it will be opened.

What is this file for?

This file is used to support Windows XP’s Multilingual User Interface, which allows you to change the language you use to interact with Windows, so for example you could say, “I want everything to be in French” and Windows will translate all its menus, shortcuts, dialog boxes, etc. into French. Specifically, this file instructs Windows how to translate the word “Startup” into French, German, Spanish, etc.

Programmatically, you use the SHSetLocalizedName function to set the multilingual name for a file or folder.

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.