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

Date:August 27, 2003 / year-entry #36
Tags:code;tipssupport
Orig Link:https://blogs.msdn.microsoft.com/oldnewthing/20030827-00/?p=42763
Comments:    5
Summary: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...

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.


Comments (5)
  1. Hello,

    On my Windows XP machine the two folders that you mentioned:

    HKEY_LOCAL_MACHINEMicrosoftWindowsCurrentVersionRun
    HKEY_CURRENT_USERMicrosoftWindowsCurrentVersionRun

    are each inside a ‘sofware’ folder like so:

    HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun
    HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun

    Just thought I would mention it in case you have a typo.

  2. Anonymous says:

    Problem 2 is common with Samba domain controllers – most configs don’t preserve the hidden and system bits, as this is a performance hit

  3. Norman Diamond says:

    Problem 1 is familiar. Actually the familiar problem has symptoms that look completely different but the cause is exactly what you described. Now, can you say why there wasn’t a patch for PhotoDraw to fix this bug in the keys that PhotoDraw put in the registry? I know that PhotoDraw is discontinued, but either before or after discontinuing, this would have been such a simple thing to include in an Office 2000 Service Pack.

  4. TestMdemons says:

    A very big thankyou for this tip, it was driving me nuts. The problem was associated with Kodak photo software.

  5. Gary says:

    Another BIG thank you for the desktop.ini fix. We have XP and samba domain controllers and none of the other "fixes" on the web worked. Yours did!

    Thanks again

    Gary

Comments are closed.


*DISCLAIMER: I DO NOT OWN THIS CONTENT. If you are the owner and would like it removed, please contact me. The content herein is an archived reproduction of entries from Raymond Chen's "Old New Thing" Blog (most recent link is here). It may have slight formatting modifications for consistency and to improve readability.

WHY DID I DUPLICATE THIS CONTENT HERE? Let me first say this site has never had anything to sell and has never shown ads of any kind. I have nothing monetarily to gain by duplicating content here. Because I had made my own local copy of this content throughout the years, for ease of using tools like grep, I decided to put it online after I discovered some of the original content previously and publicly available, had disappeared approximately early to mid 2019. At the same time, I present the content in an easily accessible theme-agnostic way.

The information provided by Raymond's blog is, for all practical purposes, more authoritative on Windows Development than Microsoft's own MSDN documentation and should be considered supplemental reading to that documentation. The wealth of missing details provided by this blog that Microsoft could not or did not document about Windows over the years is vital enough, many would agree an online "backup" of these details is a necessary endeavor. Specifics include:

<-- Back to Old New Thing Archive Index