Desktop.ini opens in Notepad on every Windows logon

Updated: December 7, 2023

If you need more reasons to dislike Windows 11, let me provide. While testing this useless version of Windows a few weeks back, I noticed that every time I'd log into the desktop session, Notepad would pop open, showing the contents of a desktop.ini file. Why? Who knows. But it is annoying.

Well, it took me a little while to narrow down the source of this issue. Eventually I did find it, removed the offending desktop.ini file, and my logons (logins in Windows parlance) have become pristine ever since. Let me show you what you need to do, should you encounter the same phenomenon. After me.

Problem in more detail

First, there does not seem to be anything wrong with your system (apart from the glaring inefficiencies and stupidity of the Windows 11 design). Everything behaves correctly, except this one desktop.ini thing. A few seconds into the desktop session, the Notepad text editors opens, and displays the contents of the above-mentioned file. The contents are as follows:


File details

The reason why Notepad pops up is because you have a desktop.ini file in a system autostart folder, and Windows tries to run the program - except this is just a configuration file, and the default association for .ini files is to open them inside a text editor, and therefore, you get the end result of this file being shown in Notepad. The only question is, which autostart folder?

There are many, many desktop.ini files on any Windows install. Every folder can have one, as it shows how the specific folder ought to be displayed, thumbnails versus list versus detailed list, and such. In general, if the configuration of a folder is different from the File Explorer defaults, then there should be a desktop.ini file inside, telling the Explorer how to show the contents when you navigate to the desired location.

In Windows, if you search for the desktop.ini file, there will be lots of results. You won't immediately know which one actually has the content you see in your case. You will need to manually open every single one to figure it out, or use a better method of search to find the offending file.

Search results

Solution (and use a refined text editor)

If you need to perform an in-file search for a specific string, e.g.: shell32.dll,-21787, your best bet is Notepad++. This amazing text editor can search for phrases (including regular expressions) for specific file types in specific locations. Exactly what we need. And the results be as follows:

Search "-21787" (2 hits in 2 files of 93 searched)
C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\desktop.ini (1 hit)
Line 3: LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21787
C:\Users\Roger Bodger\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\desktop.ini (1 hit)
Line 3: LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21787

For whatever arcane reason, there were two desktop.ini files in the Startup folder, one for the Administrator account and one for the standard account I was using. I copied the desktop.ini file to a backup location, deleted, and rebooted. Lo and behold, there were no more Notepad popups. Done.


I still do not know why Windows decided to be so annoying that it would try to "run" the desktop.ini file, or why it would decide that these ought to be run in these specific folders to begin with. The only thing I can think of is that these files lost their attributes somehow (from hidden, system to whatever), which made Windows treat them as regular files and try to execute them.

Whatever the reason, the outcome is annoying. The solution is to move the file away. First, you need to find it, for which you should use a good text editor like Notepad++. Then, you should back the file up, just in case, before deleting it. Finally, once it's gone, reboot, test system behavior, check for any adverse effects, and if there are none (there shouldn't be), enjoy a popup-free experience. Or rather, not, because Windows 11 is pointless, and you should try something else. But if this problem occurs on other versions of this operating system, then you have a way of solving it. Hopefully, this short tutorial was useful. See you around.