Here is my code
Const ALL_USERS_DESKTOP = &H19&
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(ALL_USERS_DESKTOP)
Set objFolderItem = objFolder.Self
Wscript.Echo objFolderItem.Path
objFSO.CopyFile "\\server\folder\folder\Name of File 8.5.lnk" , objFolderItem.Path , OverwriteExisting
Gives me an error on last line. I’m not sure what the problem is but I think it has to do with the lnk file. If I put a bat file or a txt file, the file gets copied. The lnk gives an error.
Using VBSEdit as my editor and CScript (not WScript)
Error message is
C:\Users\Public\Desktop
Microsoft VBScript runtime error (18, 1) : Permission denied
I know that I have access to the server and folder. I also can copy all the other non lnk files
————- UPDATE —–
I modified the code with the following
Const DESKTOP = &H10&
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(DESKTOP)
Set objFolderItem = objFolder.Self
Wscript.Echo objFolderItem.Path
objFSO.CopyFile "\\server\folder\folder\Name of File 8.5.lnk" , objFolderItem.Path , OverwriteExisting
Same thing. It says Permission denied (even to my own desktop). Using the mouse, I can create anything I want on my desktop without a password or special privs.
I had to recreate the shortcut because VBS wont copy it.