Assign icon to shortcut

Hi Guys,

Is there an easy way to assign an icon to an internet shortcut for all users?

I have a url - C:\Users\Public\Desktop\example.url with the url going to say www.test.com

then have an icon at c:\windows\system32\example.ico

I can set it manually by right clicking the file > properties > change icon. but onyl changes it for my profile.
LVL 1
TimbobalobaAsked:
Who is Participating?
 
pritamduttCommented:
Try creating a shortcut using a cscript code given below

set objShell = Wscript.Createobject("Wscript.Shell") 
strDesktopFld = objShell.SpecialFolders("Desktop") 
Set objURLShortcut = objShell.createShortcut(strDesktopFld & "\Example.lnk") 
'Name for Shortcut to add 
objURLShortcut.Targetpath = "http://www.test.com/"
'Path to icon 
objURLShortcut.IconLocation = "C:\WINDOWS\system32\shell32.dll,14" 
'Path for Shortcut 
objURLShortcut.Save

Open in new window

0
 
TimbobalobaAuthor Commented:
that did it. thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.