Skip to content
⌘ NSIS Forum Archive

changing the default icon for a directory

4 posts

softwaredevelop#

changing the default icon for a directory

I am trying to create a directory and use a different icon for the folder - is this possible?

This is the code for creating the directory - what would be the next step?

CreateDirectory "$Desktop\Primary Applications"
kichik#
If you create a file named Desktop.ini in the folder, you can put this in it to change the icon:
[.ShellClassInfo]
IconFile=%SystemRoot%\system32\SHELL32.dll
IconIndex=12
You can use WriteINIStr to write INI files. Note that this feature was not available on all Windows versions.
Anders#
it works on 98 and up (should work on 95+ie4 shellupdate)
just remember to make the desktop.ini file hidden+system+read-only
and the folder should be read-only+system
Comm@nder21#
this macro prepares any given folder to apply desktop.ini
i used it with success.
!define PathMakeSystemFolder "!insertmacro PATH_MAKE_SYSTEM_FOLDER"
!macro PATH_MAKE_SYSTEM_FOLDER pszPath
System::Call "shlwapi::PathMakeSystemFolder(t '${pszPath}') i."
!macroend
call it that way:
${PathMakeSystemFolder} "C:\MyFolder"