Skip to content
⌘ NSIS Forum Archive

Change Folder Icon creating shortcut

4 posts

papaimark#

Change Folder Icon creating shortcut

Example: I have 3 audio editors in $smprograms/audio/audio1.lnk , $smprograms/audio/audio2.lnk and $smprograms/audio/audio3.lnk
I wanto to create a subfolder $smprograms/audio/audioEDITORS/audio1.lnk... and put them in the same audioEDITORS folder.
When creating these shortcuts, is there a way to change the /audioEDITORS/ default W7 yellow icon to an icon of my choice?
(without using external softwares.)
I am just creating shortcuts to my existing softwares and stuff.
Thank you.
papaimark#
Sorry, dude. Couldn't find a link to delete this post, so ito goes.
After 5 hours I came to a simple answer:

Section
SetShellVarContext all
WriteIniStr "$smprograms\Comms\IP and LAN\Desktop.ini" .ShellClassInfo IconResource "C:\Programas\Installer\Icon\rede.ico" # rede.ico,0 did not work
WriteIniStr "$smprograms\Comms\IP and LAN\Desktop.ini" .ShellClassInfo IconIndex 0 # this seems to be mandatory
SetFileAttributes "$smprograms\Comms\IP and LAN\Desktop.ini" hidden|system|readonly # this IS mandatory
SetFileAttributes "$smprograms\Comms\IP and LAN" system|readonly #without this line, the whole folder disappears, becomes hidden
Sectionend

Using Win7-64.
papaimark#
For every first child folder after "$smprograms" this first line became imperative.
Only when changing the parent foflder too.
This was not necessary with "grandchildren" folders.

...SetShellVarContext all
SetFileAttributes "$smprograms\Comms\Desktop.ini" 0
...
JasonFriday13#
CreateShortcut supports setting the icon from a different file.

[edit] But yes, it is more involved changing the folder icon. Link to msdn for reference: https://learn.microsoft.com/en-us/wi...th-desktop-ini.