Removing and adding a shortcut RRS feed

  • Question

  • Hi all,

    I was wondering whether you could help. Basically I want to merge the 2 scripts below so that the remove shortcut script comes first before the add shortcut script.

    Remove Shortcut Script

    Option Explicit
    Dim oFS, oWsh, oNetwork, strUser, Shell
    Dim DesktopPath, link
    Dim folder, file, icon1
    Set oWsh = CreateObject("WScript.Shell")
    set oFS = WScript.CreateObject("Scripting.FileSystemObject")
    Set oNetwork= CreateObject("Wscript.Network")
    Set Shell = CreateObject("WScript.Shell")
    strUser = oNetwork.UserName
    DesktopPath = Shell.SpecialFolders("Desktop")

    icon1 = UCase(oWsh.SpecialFolders("Desktop") & "\<name of shortcut>.lnk") 

    Set folder = oFS.GetFolder(DesktopPath)
    For Each file In folder.Files

    Select Case UCase(file)
    Case icon1

    End Select

    WScript.Quit (0)

    Add Shortcut Script

    Dim FileName, UploadStac
    UploadStac ="Stac Upload"
    FileName = "<name of shortcut>"
    Set shortcut = CreateObject("WScript.Shell").CreateShortcut(CreateObject("WScript.Shell").SpecialFolders("Desktop") & + "\" + FileName + ".lnk")
    shortcut.Description = "<shortcut description>"
    shortcut.TargetPath = "<file path of shortcut>"
    shortcut.Arguments = "/Arguments:Shortcut"

    Can this be done?

    Your help would be much appreciated.

    Kind regards,


    • Moved by Bill_Stewart Wednesday, May 30, 2018 8:48 PM This is not "merge scripts for me" forum
    Wednesday, March 14, 2018 2:40 PM

All replies

  • Have you tried combining them in notepad. 

    Note that we do not fix or modify scripts on request.  You must ask the author of your scripts to modify them.

    We also do not use "Quit" at the end of a script.  Scripts terminate on their own.


    Wednesday, March 14, 2018 2:45 PM
  • Hi jrv,

    I have but still experiencing issues in getting them to work together, looks like I will have to go back to basics. Sorry for the delay in getting back to you.



    Monday, April 2, 2018 11:48 AM