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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vbscript Shortcut Creation Script - Icon Disappears

Status
Not open for further replies.

pshelfo

IS-IT--Management
Apr 27, 2004
16
US
I have the following script which I ran from a network share. A desktop shortcut was created and an .ico file dropped onto the workstation. When I removed the vbscript from the server share the icon for the shortcut I created disappeared even though when you go into the shortcut the icon is still there to select and works fine afterwards. What happened?

Option Explicit

'***** Variable Declarations *****

Dim FSO, WshShell, Desktop, oShellLink
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
Desktop = WshShell.SpecialFolders("ALLUsersDesktop")

' ***** Main Body *****

'Conditional Logic to Run Script

If FSO.FileExists(""&Desktop&"\app.lnk") Then
wscript.quit
Else
'Copy Icon File
FSO.CopyFile "\\servername\share\app.ico", "C:\", True

'Create Shortcut
set oShellLink = WshShell.CreateShortcut(Desktop & "\app.lnk")
oShellLink.IconLocation = "c:\app.ico"
oShellLink.TargetPath = "\\servername\sharename\launch.vbs"
oShellLink.WorkingDirectory = "C:\"
oShellLink.Save
End If

' ***** End of Script *****
 
I have noticed that the icon disappears whenever a laptop is not connected to the network. However, the icon file is copied to the local machine and is pointed locally. The only remote pointer is the target path which is the server share. Does the display of a icon file depend on the target path?
 
If you are using Visual Studio 2005 Deploy Project now. then you know it has some error. if it has a vbscript with an action then the icon and shortcut will not be created.

It's a bug.

And a solution is

Orca tool can edit shortcut property correctly with open the msi file and editing.

Orca tool is in windows installer or Platform SDK with the file form of Orcal.msi, you can download Widnows 2003 PlatFrom SDK in Microsoft site. and find Orca.msi in installed folders and run Orca.msi and it will be installed.

My system is Xp but Windows 2003 Platform SDK works fine.

Or you can make your own VBScript for manuplate shortcut property and shortcut file for an action.
But I don't know how.
And I'm now suffering how to write install path to a Register.

Bye, I hope this will help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top