Hi,
I've been using a vb script (which I found on the internet) to put shortcuts on users desktops (xp) for several years now .
Intermittently, the user gets an error that the shortcut cannot be saved. (not a permission problem)
I am about to do a new server deployment and thought it would be a good idea to address it (it was only ever an annoyance).
To address this I am looking at getting the script to check if the shortcut is already created and delete it and recreate it if it is.
The first problem I am having is combining a special folder path with a string. I suspect I'll have issues with the IF statement after I get past that hurdle...
My script...
Dim Shell, DesktopPath, URL
Set Shell = CreateObject("WScript.Shell")
DesktopPath = Shell.SpecialFolders("Desktop")
Set URL = Shell.CreateShortcut(DesktopPath & "\Scootle.LNK")
' Combine file path
FilePath.CombinePath(DesktopPath & "\Scootle.LNK")
If URL.FileExists(FilePath) then
URL.DeleteFile FilePath, True
Set URL = Shell.CreateShortcut(DesktopPath & "\Scootle.LNK")
URL.TargetPath = " URL.IconLocation = "\\server\netlogon\icons\scootle.ico"
URL.Save
Else
Set URL = Shell.CreateShortcut(DesktopPath & "\Scootle.LNK")
URL.TargetPath = " URL.IconLocation = "\\server\netlogon\icons\scootle.ico"
URL.Save
End If
Quite clearly I have no idea what I am doing! Any help would be appreciated!
Thanks.
I've been using a vb script (which I found on the internet) to put shortcuts on users desktops (xp) for several years now .
Intermittently, the user gets an error that the shortcut cannot be saved. (not a permission problem)
I am about to do a new server deployment and thought it would be a good idea to address it (it was only ever an annoyance).
To address this I am looking at getting the script to check if the shortcut is already created and delete it and recreate it if it is.
The first problem I am having is combining a special folder path with a string. I suspect I'll have issues with the IF statement after I get past that hurdle...
My script...
Dim Shell, DesktopPath, URL
Set Shell = CreateObject("WScript.Shell")
DesktopPath = Shell.SpecialFolders("Desktop")
Set URL = Shell.CreateShortcut(DesktopPath & "\Scootle.LNK")
' Combine file path
FilePath.CombinePath(DesktopPath & "\Scootle.LNK")
If URL.FileExists(FilePath) then
URL.DeleteFile FilePath, True
Set URL = Shell.CreateShortcut(DesktopPath & "\Scootle.LNK")
URL.TargetPath = " URL.IconLocation = "\\server\netlogon\icons\scootle.ico"
URL.Save
Else
Set URL = Shell.CreateShortcut(DesktopPath & "\Scootle.LNK")
URL.TargetPath = " URL.IconLocation = "\\server\netlogon\icons\scootle.ico"
URL.Save
End If
Quite clearly I have no idea what I am doing! Any help would be appreciated!
Thanks.