4

Maybe this is only on localized version of Windows, I don't know.

If you rename a folder while in a Windows Search result window, instead of renaming the file, it will create a desktop.ini file and add a LocalizedResourceName variable with the new name instead.

As a result, there will be a discrepancy between the real folder name and the displayed folder name in Windows Explorer.

I spent hours tonight trying to find a solution, and then trying to delete desktop.ini files in a specific folder recursively without success.

So, here I am, asking for help. Is this a bug or not ?!

  1. Is there a way to prevent Windows Explorer to edit the desktop.ini file and rather rename the actual filename ?
  2. If this is a bug, why can't I find more people complaining about it ? Is there something wrong with the machine I get this issue on ? And if so, how to troubleshoot this ?
  3. How to get rid of desktop.ini files as a workaround ? I tried Powershell, I tried Unlocker and LockHunter. I tried the many things including del /f /s command. Everything fails because Windows is protecting these system files.

Note that in the past, on the same machine, and on Windows 10, I tried to fix this looking after Windows Search. Without success. I even ended up moving the index files and trying different set of permissions. Could it be related ? (Why ?!)

Hope someone can help. This drove me really mad.

5
  • I use Search a lot. I exit Search before performing file operations. This will likely help you
    – anon
    Commented Apr 8, 2023 at 2:03
  • In case you are curious, I have never seen this bug and don't run a localized version. It might exist I guess.. but have never seen this behavior. Commented Apr 8, 2023 at 3:07
  • Are you renaming folders with 'system' names or just any name? System names must be preserved, ie "Documents, Pictures" so they can be found by International resources. This entails using the local name as a kind of 'overlay' that only the local user sees.
    – Tetsujin
    Commented Apr 8, 2023 at 6:37
  • I can't reproduce this. Does it happen when booting in Safe mode?
    – harrymc
    Commented Apr 8, 2023 at 8:07
  • The only discussion I can find on the topic is this one answers.microsoft.com/en-us/windows/forum/… Back to Windows 7. I wonder if installing win11 from scratch would solve the issue. I'm in the process of deploying a fresh VM to try reproduce with Win11. Commented Apr 8, 2023 at 18:30

2 Answers 2

2

I am seeing the behavior the OP describes.

  1. Test folder with two subfolders:

    enter image description here

  2. Rename #1 via file folder:

    enter image description here

  3. Result of step #2:

    enter image description here

  4. Search: kind:Folder:

    enter image description here

  5. Rename #2

    enter image description here

  6. Result of step #5 (note the attribute change and unchanged file system folder):

    enter image description here

  7. Contents of desktop.ini in #2:

    [.ShellClassInfo]
    LocalizedResourceName=Ordinary Folder II -Renamed
    

As I (and seemingly others) were unaware of this behavior, I don't know of any fix". The workaround suggested by @John, exiting search before renaming, seems the best short-term bet.

You don't need to delete the desktop.ini files to have the folders display their filesytem names, clearing the ReadOnly attribute for the folder will prevent processing of the desktop.ini file. This PowerShell snippet will recursively clear the attribute for any folder that contains a desktop.ini file (starting with the current working directory):

gci desktop.ini -Recurse -Force | ForEach{
    $folder = Get-Item $_.DirectoryName
    $folder.Attributes = $folder.Attributes -band -not [IO.FileAttributes]::ReadOnly
}

And this will set the attribure for same:

gci desktop.ini -Recurse -Force | ForEach{
    $folder = Get-Item $_.DirectoryName
    $folder.Attributes = $folder.Attributes -bor [IO.FileAttributes]::ReadOnly
}
1
  • 1
    Thank you Keith. I'll give it a try ASAP. As it's on a friend's computer, I need to book an spontanément with her to have a look. I'll get back to you soon. Commented Apr 18, 2023 at 23:13
0

clearing read only did not work for me. i created a script to scan for mismatched folders and optionally delete the offending desktop.ini: https://gist.github.com/eyaler/2ad37a7edd04f1a4ce339047ce5feabd

2
  • Did you clear the attribute on the folder via cmd.exe or PowerShell??? To verify, you have to check the parent folder in Details view with the attribute column added. I have to ask, since so many are misled by the checkbox in a folder's Properties dialog -- which doesn't affect the folder at all. It's the proverbial "t*ts on a bull"... :D Commented Jan 7 at 1:50
  • 1
    i was misled indeed Commented Jan 7 at 18:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .