Skip to content

Instantly share code, notes, and snippets.

@hyrious
Last active May 10, 2024 00:10
Show Gist options
  • Save hyrious/aa87fe5c4161da438b50af84288ee873 to your computer and use it in GitHub Desktop.
Save hyrious/aa87fe5c4161da438b50af84288ee873 to your computer and use it in GitHub Desktop.
restore desktop.ini if some guy messed them up

Take %UserProfile%\Desktop\desktop.ini for example.

  1. Create a desktop.ini file with content below and saved in UTF-16 LE with BOM. Hopefully notepad.exe has such choice to use the right encoding.
[.ShellClassInfo]
LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21769
IconResource=%SystemRoot%\system32\imageres.dll,-183
  1. Change desktop.ini's attributes to +A +S +H (Archived, System, Hidden)
attrib +A +S +H %UserProfile%\Desktop\desktop.ini
  1. Change %UserProfile%\Desktop folder's attributes to +R (Read-only)
attrib +R %UserProfile%\Desktop
  1. Restart explorer.exe

Debug

If it doesn't work, try attrib +S %UserProfile%\Desktop.

Default folders' desktop.ini

Documents

[.ShellClassInfo]
LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21770
IconResource=%SystemRoot%\system32\imageres.dll,-112
IconFile=%SystemRoot%\system32\shell32.dll
IconIndex=-235

Pictures

[.ShellClassInfo]
LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21779
InfoTip=@%SystemRoot%\system32\shell32.dll,-12688
IconResource=%SystemRoot%\system32\imageres.dll,-113
IconFile=%SystemRoot%\system32\shell32.dll
IconIndex=-236

Downloads

[.ShellClassInfo]
LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21798
IconResource=%SystemRoot%\system32\imageres.dll,-184

Favorites

[.ShellClassInfo]
LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21796
IconResource=%SystemRoot%\system32\imageres.dll,-115
IconFile=%SystemRoot%\system32\shell32.dll
IconIndex=-173

Links

[.ShellClassInfo]
LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21810
IconResource=%SystemRoot%\system32\imageres.dll,-185
DefaultDropEffect=4
[LocalizedFileNames]
Desktop.lnk=@shell32.dll,-21769
Downloads.lnk=@shell32.dll,-21798

Music

[.ShellClassInfo]
LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21790
InfoTip=@%SystemRoot%\system32\shell32.dll,-12689
IconResource=%SystemRoot%\system32\imageres.dll,-108
IconFile=%SystemRoot%\system32\shell32.dll
IconIndex=-237

Videos

[.ShellClassInfo]
LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21791
InfoTip=@%SystemRoot%\system32\shell32.dll,-12690
IconResource=%SystemRoot%\system32\imageres.dll,-189
IconFile=%SystemRoot%\system32\shell32.dll
IconIndex=-238
@Jamesstevens-3rd
Copy link

@gutenfries
Copy link

Why don't we have a reaction button for gists yet?

anyway, thumbs up, thank you for contributing this 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment