sqlchild
sqlchild

Reputation: 9064

creating an icon of a shortcut of a batch file using nsis installer

I need to set an icon for my batch file OR for the shortcut of my batch file , using the nsis installer. Can an icon be set only of a shortcut , or can i set the icon of the main batch file whose shortcut needs to be created.

The following code isn't working:

I have a folder MyAccountSoftware, my installer will compile the files of this folder into the exe file. This folder has these two files :-

---MyAccountSoftware
       |______Account.BAT
       |______Account.ico

  SetOutPath $INSTDIR\  
  File "MyAccountSoftware\Account.BAT"  

CreateShortCut "$INSTDIR\Account.lnk" "$INSTDIR\Account.BAT" "$INSTDIR\Account.ico"

This code, just copies the file Account.BAT into the required $INSTDIR, and creates a shortcut - Account.Ink in the $INSTDIR, but doesn't set the icon of the Shortcut. Please help.

Upvotes: 2

Views: 4620

Answers (1)

Anders
Anders

Reputation: 101569

Batch files cannot have custom icons. When creating the shortcut, even if you don't need a parameter you still need to provide a empty string:

CreateShortCut "$INSTDIR\Account.lnk" "$INSTDIR\Account.BAT" "" "$INSTDIR\Account.ico"

Upvotes: 7

Related Questions