/build/static/layout/Breadcrumb_cap_w.png

Assigning icon to shortcut

Hi

I need VB script to assign a icon(.ico) to the shortcut(.lnk).

0 Comments   [ + ] Show comments

Answers (5)

Posted by: AngelD 15 years ago
Red Belt
0
set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\My Shortcut.lnk")
oShellLink.IconLocation = "C:\Icon.ico"
oShellLink.Save
Posted by: nrkres 15 years ago
Senior Yellow Belt
0
Thanks for ur reply.
but the lnk file is not in Desktop. C:\Documents and Settings\All Users\Start Menu\Applications\abc.lnk.
If that is the case what should i give in the script

Regards,
NRK
Posted by: zipsantro 15 years ago
Purple Belt
0
strPrograms = WshShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%") & "\Start Menu\Applications"
set oShellLink = WshShell.CreateShortcut(strPrograms & "\abc.lnk")

In the operating system we have few Environment Varables and few special folders. VBScript invokes them with two funtions and those are SpecialFolders (If using Special Folders) and ExpandEnvironmentStrings (Env var needs to be expanded before use).

Hope this help you understand.
Posted by: anonymous_9363 15 years ago
Red Belt
0
...someone else completely unable to use Google.
Posted by: nrkres 15 years ago
Senior Yellow Belt
0
thanks for ur support
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ