none
Error saving shortcut RRS feed

  • Question

  • Hi

    I am getting this error on Win 10 pro. I am trying to create a shortcut using code below but it is giving me 'Unable to save shortcut, Code: 80070005' on link.save. 

    What am I doing wrong?

    Thanks

    Regards

    Set objShell = CreateObject("WScript.Shell")
    
    dstFolderPrefix = ""
    dstFolder = "C:\AppFolder\" & Mid(FormatDateTime(date,0),7,4) & "." & Mid(FormatDateTime(date,0),4,2) & "." & Mid(FormatDateTime(date,0),1,2)
    dstFolderFile = dstFolder & "\My App.mde"
    strFolder = objShell.SpecialFolders("AllUsersDesktop")
    
    Set link = objShell.CreateShortcut(strFolder & "\My App.lnk")
    link.Description = "My App"
    link.WorkingDirectory = dstFolder
    
    If dstFolderPrefix <> "" then
      link.TargetPath = dstFolderPrefix 
      link.Arguments = """" & dstFolderFile & """"
    Else
      link.TargetPath = dstFolderFile
    End If
    
    link.IconLocation = "C:\Windows\System32\SHELL32.dll, 13"
    link.Save








    • Edited by Y a h y a Thursday, May 18, 2017 3:00 AM
    • Moved by Bill_Stewart Friday, July 7, 2017 6:25 PM You cannot bypass the UAC prompt
    Thursday, May 18, 2017 2:50 AM

All replies