Assign icon to shortcut

Posted on 2011-10-09
Medium Priority
Last Modified: 2012-05-12
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.
Question by:Timbobaloba

Accepted Solution

pritamdutt earned 2000 total points
ID: 36938503
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 

Open in new window


Author Comment

ID: 36938537
that did it. thanks

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question