A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows XP » Customizing Windows XP
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

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



 
 
Thread Tools Display Modes
  #1  
Old July 22nd 08, 10:08 PM posted to microsoft.public.windowsxp.customize
booker@mgt[_2_]
external usenet poster
 
Posts: 3
Default Trying to change an icon for a shortcut via vbs/command line

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

Ads
  #2  
Old July 23rd 08, 05:37 AM posted to microsoft.public.windowsxp.customize
Andrew E.
external usenet poster
 
Posts: 3,409
Default Trying to change an icon for a shortcut via vbs/command line

Open control-panel,folder options,file types,edit.

"booker@mgt" wrote:

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

  #3  
Old July 23rd 08, 07:02 AM posted to microsoft.public.windowsxp.customize
ju.c[_2_]
external usenet poster
 
Posts: 1,133
Default Trying to change an icon for a shortcut via vbs/command line

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


"Andrew E." wrote in message
...
Open control-panel,folder options,file types,edit.

"booker@mgt" wrote:

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

  #4  
Old July 24th 08, 10:07 AM posted to microsoft.public.windowsxp.customize
Ramesh, MS-MVP[_2_]
external usenet poster
 
Posts: 414
Default Trying to change an icon for a shortcut via vbs/command line

Does using an icon file (.ico) help?

--
Regards,

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


"booker@mgt" wrote in message
...
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



  #5  
Old July 28th 08, 05:18 AM posted to microsoft.public.windowsxp.customize
a_nonymous
external usenet poster
 
Posts: 30
Default Trying to change an icon for a shortcut via vbs/command line

"booker@mgt" wrote:
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


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.)


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off






All times are GMT +1. The time now is 12:01 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.