locked
Change Folder Icon RRS feed

  • Question

  • Hi,

    I have my C# application, when deploying the application I am creating a folder in My Document called My Lab.

    I want to give a special icon for it but there is not way to do that in Windows Installer, Installshield not Advanced Installer.

    How can I do this please?

    Thanks,

    jassim

    Monday, June 20, 2016 11:44 PM

Answers

  • If the installer can set the “Read-only” attribute for the folder, or you can instruct it to run “attrib MyFolder +R” command during installation, then include into the folder the icon file (e.g. “MyIcon.ico”) and also a special text file called “Desktop.ini”, usually hidden, having a contents like this:

    [.ShellClassInfo]
    IconFile=MyIcon.ico
    IconIndex=0

    The documentation can be found here: https://msdn.microsoft.com/en-us/library/windows/desktop/cc144102(v=vs.85).aspx. You can also perform some experiments in Properties window for folder in File Explorer, which allows customisations and creates the Desktop.ini file for you.

    • Marked as answer by Jassim Rahma Tuesday, June 21, 2016 9:44 AM
    Tuesday, June 21, 2016 5:50 AM

All replies

  • If the installer can set the “Read-only” attribute for the folder, or you can instruct it to run “attrib MyFolder +R” command during installation, then include into the folder the icon file (e.g. “MyIcon.ico”) and also a special text file called “Desktop.ini”, usually hidden, having a contents like this:

    [.ShellClassInfo]
    IconFile=MyIcon.ico
    IconIndex=0

    The documentation can be found here: https://msdn.microsoft.com/en-us/library/windows/desktop/cc144102(v=vs.85).aspx. You can also perform some experiments in Properties window for folder in File Explorer, which allows customisations and creates the Desktop.ini file for you.

    • Marked as answer by Jassim Rahma Tuesday, June 21, 2016 9:44 AM
    Tuesday, June 21, 2016 5:50 AM
  • Is there any way to do it from the registry?
    Tuesday, June 21, 2016 9:31 AM
  • No I don't think there is any option to change in registry. As you are looking to change icon for specific folder, desktop.ini is only possibility as suggested by "Viorel_".

    You can do in registry if you plan to change default icon of folder.

    https://bytes.com/topic/visual-basic-net/answers/373323-change-folder-icon-programmatically


    Gaurav Khanna | Microsoft .NET MVP | Microsoft Community Contributor

    Tuesday, June 21, 2016 9:43 AM
  • Do I need this:

    Attrib +S “Path to Folder”

    Tuesday, June 21, 2016 9:52 AM