change desktop icon target path?
I have code in my app that deletes an existing icon and recreates it with a new target path. This is my code, it seems like over kill to me.
Is it possible to just change the target paths file name instead of deleting it and then recreating it?
VB Code:
'delete the flash shortcut
Dim shell As Object
Dim link As Object
Dim DesktopPath As String
Set shell = CreateObject("WScript.Shell")
DesktopPath = shell.SpecialFolders("AllUsersDesktop")
fso.DeleteFile DesktopPath & "\Agent Prospecting Presentation.lnk"
'create a new flash shortcut
'because we are replacing the old exe
Set shell = CreateObject("WScript.Shell")
DesktopPath = shell.SpecialFolders("AllUsersDesktop")
Set link = shell.CreateShortcut(DesktopPath & "\Agent Prospecting Presentation.lnk")
'link.Arguments = "1 2 3"
link.Description = "Agent Prospecting Presentation"
'link.HotKey = "CTRL+ALT+SHIFT+X"
link.IconLocation = "C:\WestfieldInsurance\Westfield_1to1F_v1.exe,1"
link.TargetPath = "C:\MyWestfieldPresentation\Westfield_1to1F_v1.exe"
'window style 3=maximized, 2=normal
link.WindowStyle = 2
'start in
link.WorkingDirectory = "C:\MyWestfieldPresentation"
link.Save
Re: change desktop icon target path?
See this code by RobDog888.