[VBScript] - Create desktop shortcut

Discussion in 'Mixed Languages' started by Josh Cell, Sep 26, 2011.

  1. Josh Cell

    Josh Cell MDL Developer

    Jan 8, 2011
    3,515
    7,170
    120
    #1 Josh Cell, Sep 26, 2011
    Last edited by a moderator: Apr 20, 2017
    For create shortcut using .vbs files, I've created this small script:

    Code:
    Dim FileName
    FileName = "MyShortcut"
    Set shortcut = CreateObject("WScript.Shell").CreateShortcut(CreateObject("WScript.Shell").SpecialFolders("Desktop") & + "\" + FileName + ".lnk")
    shortcut.Description = "My shortcut"
    shortcut.TargetPath = "C:\My Shortcut"
    shortcut.Arguments = "/Arguments:Shortcut"
    shortcut.Save
    Very useful for installers / manual .lnk insertion :worthy:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. Acerjojo12

    Acerjojo12 MDL Novice

    Jan 3, 2012
    1
    0
    0
    Doesnt work

    I tryed that... It looks like its working exept that It gives an error for shortcut.Description shortcut.TargetPath shortcut.Arguments shortcut.Save, It doent know what they are. If you could help me that would be great.o_O
     
  3. NICK@NUMBER11

    NICK@NUMBER11 MDL Expert

    Mar 23, 2010
    1,503
    720
    60
    Works for me, ran from desktop all ok?
     
  4. WIKIMACK

    WIKIMACK MDL Expert

    Nov 10, 2011
    1,535
    1,009
    60
    [h=2]http://91.68.211.12/bmi/forums.mydigitallife.net/images/icons/icon1.png Hi[/h]Works for me, ran from desktop all ok :rolleyes:
     
  5. Josh Cell

    Josh Cell MDL Developer

    Jan 8, 2011
    3,515
    7,170
    120
    #5 Josh Cell, Jan 3, 2012
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Code:
    Dim FileName
    FileName = "C:\Program Files\NFSUndercover\speed.exe"
    Set shortcut = CreateObject("WScript.Shell").CreateShortcut(CreateObject("WScript.Shell").SpecialFolders("Desktop") & + "\" + FileName + ".lnk")
    shortcut.Description = "My shortcut"
    shortcut.TargetPath = "C:\My Shortcut"
    shortcut.Arguments = "/Arguments:Shortcut"
    shortcut.Save
    Works well here...
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...