Desktop.ini: What is it, what can it be used for and what properties does it support?

No doubt you've come across the mysterious 'desktop.ini' file before - especially if you often have hidden files set to show. But what exactly is this file? How can a seemingly empty folder end up with this file? What does it even do? Well, read on to find the answers to all those questions!

What is desktop.ini?

Desktop.ini is a basic text file that can often be found hidden in folders. Desktop.ini actually stores various properties and information about its parent folder for use by file browsers when displaying the folder. There are various things you can change about how the folder looks by using Desktop.ini, such as setting a ToolTip to display when the user mouses-over the folder or setting custom text to display when the folder is empty. Another use is to specify string resources to use for files in the folder - this allows for localisation, meaning that file names can appear different depending on your system's default language. 

Another example is in our app QPad. We are currently experimenting with a new file recovery system for the app, which will store recovered files in a special folder in the event of the app crashing. To provide a better user experience when the user visits this folder, Desktop.ini is used. Below is the Desktop.ini we currently have in internal testing versions of QPad:

[ViewState]

FolderType=Documents

Vid={137E7700-3573-11CF-AE69-08002B2E1262}

[.ShellClassInfo]

ConfirmFileOp=1

InfoTip=Contains recovered documents from QPad.

EmptyText=There are currently no recovered documents.




What properties does it support?

Desktop.ini files can contain various sections with various properties. See the example above of the QPad recovery folder to see the syntax (It has two sections, [ViewState] and [.ShellClassInfo]. Documentation on this mysterious file is scarce, however, we've managed to collate various different properties you can set in a Desktop.ini file. Note that some of these properties may not work unless the folder is marked as a system folder. You can quickly do this from the command line using attrib. It's also common practice to make these folders hidden. Run the following command in a folder to mark a Desktop.ini file as hidden and system: 'attrib +s +h Desktop.ini'.

[ViewState]

  • FolderType - the value of the 'Optimise this folder for' option in the folder properties dialog. For example, 'Documents'. Some possible values that can be used here are:
    • Documents
    • MyDocuments
    • Pictures
    • MyPictures
    • PhotoAlbum
    • Music
    • MyMusic
    • MusicArtist
    • MusicAlbum
    • Videos
    • MyVideos
    • VideoAlbum
    • UseLegacyHTT
    • CommonDocuments
    • Generic

  • Vid and Mode - Specifies the view mode of the folder. Some CLSIDs that can be used here are:
       
       CLSID Key   View ModeMode
       {0057D0E0-3573-11CF-AE69-08002B2E1262}   Icons1
       {0E1FA5E0-3573-11CF-AE69-08002B2E1262}   List3
       {137E7700-3573-11CF-AE69-08002B2E1262}   Details4
       {8BEBB290-52D0-11D0-B7F4-00C04FD706EC}   Thumbnail5
       {65F125E5-7BE1-4810-BA9D-D271C8432CE3}   Tiles6
       {8EEFA624-D1E9-445B-94B7-74FBCE2EA11A}   Filmstrip7
  • Logo - Corresponds to the 'Choose a file to display on this folder icon' options in the folder properties dialog box:


[.ShellClassInfo]

  • ConfirmFileOp - Can be specified on a system folder with a value of 0 to avoid a "You Are Deleting a System Folder" warning when deleting or moving the folder. Here is an example of what that warning can look like:


  • NoSharing - Not supported on Windows Vista or later. Set this entry to 1 to prevent the folder from being shared.
  • IconFile - Specify a custom icon for the folder. Set this entry to the icon's file name. The .ico file name extension is preferred, but it is also possible to specify .bmp files, or .exe and .dll files that contain icons. If you use a relative path, the icon is available to people who view the folder over the network. You must also set the IconIndex entry.
  • IconIndex - Set this entry to specify the index for a custom icon. If the file assigned to IconFile only contains a single icon, set IconIndex to 0.
  • InfoTip - The tooltip to display when hovering the mouse over the folder and in the Comments field (can be set to a string or path to a string resource):


  • EmptyText - Custom text to display when the folder is empty. Normally, a message such as 'This folder is empty' will display when viewing an empty folder. However, this can be changed by setting this value to something else. Here is an empty folder with a custom empty text set (note that the folder is not technically empty as it obviously has the Desktop.ini file in it, but it is common practice to set Desktop.ini to hidden. When you attempt to view a folder that has no non-hidden items and you don't have the option to show hidden items enabled, it will tell you that the folder is empty and display the empty text):


  • LocalizedResourceName - A path to a resource file and id to use for the folder's display name. For example, Windows Live Mail uses this property for it's stationary folder:
  • DefaultDropEffect - Specifies the default action when performing a drop operation on this folder. Possible values here that we know of are 1 for copy, 2 for move and 4 for create shortcut.
  • CLSID - Class ID for the folder. This can be used to create special and system folders. An example of a folder which you may have on your system that uses this is in C:\Windows\assembly. The file C:\Windows\assembly specifies a custom class which customises this folder. For example, it collates various files from multiple folders into one view and contains custom columns in the details view. It also contains custom context menu items, dialogs and help information.

[LocalizedFileNames]

This section specifies resources to use for the display names of folders. Can be used to localise file names based on the system's language settings. An example of that is the Windows Media folder, which contains various built-in sound effects in Windows:

[Encryption]

  • Disable. Set to 1 to disable EFS encryption for the specified folder. When trying to enable encryption on a folder with this attribute, you'll get an error message like this:

[{F29F85E0-4FF9-1068-AB91-08002B27B3D9}]

This section can be used for specifying various properties on the folder, such as its name and author. Some values that can be used here are (replace the content withing [] with whatever you want):

  • Prop2=31,[Title]
  • Prop3=31,[Subject]
  • Prop4=31,[Author]
  • Prop5=31,[Tags}
  • Prop6=31,[Comments]


 


Did this guide help you? Do you have anything to add? Do you know of any other properties and/or sections that can be used in Desktop.ini? Let us know in the comments and we'll add them to this article. Also, if this guide did help you and you use an AdBlocker and you want to support us, consider disabling it for this site - if you do, it will be greatly appreciated!

Follow us to be notified when we release new guides:




Comments

Popular posts from this blog

How to show placeholder text in a WPF TextBox in C# and VB

How to enable dark title bar in WPF and Windows Forms/WinForms apps in C# and VB

How to use modern icons in XAML in WPF on Windows 10 and 11

How to change the colour of a WPF or Windows Forms/WinForms title bar in Windows 11 in C# and VB

Microsoft WebView2: How to check if the WebView2 runtime is installed in C# and VB