Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows VistaWindows XPWindows MeWindows 98Windows 95Virtual PCInternet ExplorerOutlook ExpressWindows MediaSecurity
Related Topics
MS Server ProductsMS OfficePC HardwareMore Topics ...

Windows Forum / Windows XP / Customization / July 2008

Tip: Looking for answers? Try searching our database.

Trying to change an icon for a shortcut via vbs/command line

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
booker@mgt - 22 Jul 2008 22:08 GMT
I have the following vbs script running as a logon script.  But everytime it
runs, When the shortcut is created, it is created with the symbol of no icon.
How can I direct the icon location to an actual windows system icon file.  
When I open up a file via properties, and browse for a new icon, it directs
me to look in shell32.dll, but I can't find a way to get to all of those
icons shown in that window.

Thanks

set objShell = Wscript.Createobject("Wscript.Shell")
strDesktopFld = objShell.SpecialFolders("Desktop")
Set objURLShortcut = objShell.createShortcut(strDesktopFld &
"\Install-CoM-Applications.lnk")
'Name for Shortcut to add
objURLShortcut.Targetpath = "http://localhost:9595/webportal/webportal.exe"
'Path to icon
objURLShortcut.IconLocation = "C:\WINDOWS\system32\oobe\images\thanks8.png"
'Path for Shortcut
objURLShortcut.Save
Andrew E. - 23 Jul 2008 05:37 GMT
Open control-panel,folder options,file types,edit.

> I have the following vbs script running as a logon script.  But everytime it
> runs, When the shortcut is created, it is created with the symbol of no icon.
[quoted text clipped - 15 lines]
> 'Path for Shortcut
> objURLShortcut.Save
ju.c - 23 Jul 2008 07:02 GMT
You cannot, I think, use a PNG file as an icon. You must convert "thanks8.png" to an icon
file. That should work.

ju.c

>  Open control-panel,folder options,file types,edit.
>
[quoted text clipped - 17 lines]
>> 'Path for Shortcut
>> objURLShortcut.Save
Ramesh, MS-MVP - 24 Jul 2008 10:07 GMT
Does using an icon file (.ico) help?

Signature

Regards,

Ramesh Srinivasan, Microsoft MVP  [Windows Shell/User]
The Winhelponline Blog: http://www.winhelponline.com/blog
Windows® Troubleshooting:  http://www.winhelponline.com

>I have the following vbs script running as a logon script.  But everytime
>it
[quoted text clipped - 20 lines]
> 'Path for Shortcut
> objURLShortcut.Save
a_nonymous - 28 Jul 2008 05:18 GMT
> I have the following vbs script running as a logon script.  But everytime it
> runs, When the shortcut is created, it is created with the symbol of no icon.
[quoted text clipped - 14 lines]
> 'Path for Shortcut
> objURLShortcut.Save

In 'Path for Icon' line,
"C:\WINDOWS\system32\shell32.dll,0"
will use the first icon in the file 'shell32.dll'. The number after the ','
is the zero-based index of the icon in any file which contains at least one icon.

In the 'Change Icon' dialog, the index value of the top-left icon is '0'.
0 4 8 ...
1 5 ...
2 6 ...
3 7 ...

(Your 'Path to icon' and 'Path for Shortcut' comments are transposed.)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.