Hi

I need VB script to assign a icon(.ico) to the shortcut(.lnk).
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Answers

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
Answered 09/25/2008 by: AngelD
Red Belt

Please log in to comment
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
Answered 09/25/2008 by: nrkres
Senior Yellow Belt

Please log in to comment
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.
Answered 09/25/2008 by: zipsantro
Purple Belt

Please log in to comment
0
...someone else completely unable to use Google.
Answered 09/26/2008 by: VBScab
Red Belt

Please log in to comment
0
thanks for ur support
Answered 09/26/2008 by: nrkres
Senior Yellow Belt

Please log in to comment
Answer this question or Comment on this question for clarity