Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to change the vbscript standard icon 1

Status
Not open for further replies.

kweh4

Technical User
Aug 8, 2001
33
0
0
US
I created a script that place 3 shortcuts on the user desktops. These shortcuts are also scripts that launch programs on the computer (For example, when the script is double click, it checks for given conditions before opening the program). My boss want these script icons to look like the programs they are launching standard icons rather than the standard vb icons that are now on the desktop. Can anyone who have good scripting background point to the solution for this problem? How do change the script so that it paste the program desktop icon to the desktop rather than vbscript icon.

thanks!

MCSE 2000
Computer Engineering Technology
 
You need for the icons to exist in either an EXE or a DLL. ICO files are not recognised when creating shortcuts via vbscript.

the contect is as follows:

objShell = WScript.CreateObject("WScript.Shell")
objShtCut = objShell.CreateShortcut
("C:\Documents And Settings\UserName\Desktop\Shortcut To Test.vbs.lnk")
objShtCut.IconLocation = "C:\winnt\system32\shell32.dll,3"
objShtCut.Save
WScript.Echo(objShtCut.IconLocation)


Note, like an array, Icons files are zero indexed. So inthe example above, I have selected the 4th icon not the 3rd.

I hope you find this post helpful.

Regards,

Mark
 
yourShortcutObject.IconLocation = "\path\to\launchedprog.exe, 0"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PHV, that is exactly what I was looking for and it worked like magic. Have a star.

MCSE 2000
Computer Engineering Technology
 
Hmm, did I or did I not provide the same information earlier? [sadeyes]

objShtCut.IconLocation = "C:\winnt\system32\shell32.dll,3"

I hope you find this post helpful.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top