Results 1 to 6 of 6
  1. #1
    nathanael890's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Posts
    158
    Reputation
    13
    Thanks
    46
    My Mood
    Bored

    Shortcut Argument

    Hi again. I've got another problem in making shortcuts..

    Code:
    Dim [Object] As Object = CreateObject("WScript.Shell")
    
                [Shortcut] = [Object].CreateShortcut([ShortcutName])
                [Shortcut].TargetPath = [Filename]
                [Shortcut].WorkingDirectory = [StartUpPath]
                [Shortcut].WindowStyle = 0
                [Shortcut].IconLocation = [Icon]
                [Shortcut].Save()
    This is the code I'm using. (Usually, its incomplete but it should be a good information)
    I don't know what is the command for the arguments since I'm getting an error of incorrect parameter.

    Example Shortcut:
    Code:
    [Shortcut].TargetPath = "C:\Program Files\Software\Software.exe" C:\Myfile.dll
    When I always make shortcuts like that, it happens to be a wrong parameter.

    Even I use The code below, it still occurs..
    Code:
    Dim MyFile As String = "C:\Program Files\Software\Software.exe C:\Myfile.dll"
    [Shortcut].TargetPath = MyFile
    Any suggestions?


    Status: Unknown

  2. #2
    sythe179's Avatar
    Join Date
    Jun 2010
    Gender
    male
    Location
    The internet
    Posts
    660
    Reputation
    15
    Thanks
    1,458
    My Mood
    Paranoid
    well...opening a program uses :
    [highlight=vb.net]
    Dim startInfo As New ProcessStartInfo("C:\Program Files\Counter-Strike Source\hl2.exe")
    startInfo.Arguments = "-nomaster -game cstrike -nojoy"
    Process.Start(startInfo)
    [/highlight]

    so..play around with it?...

    (c/p from post 3 pages back)

  3. #3
    nathanael890's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Posts
    158
    Reputation
    13
    Thanks
    46
    My Mood
    Bored
    Quote Originally Posted by *****179 View Post
    well...opening a program uses :
    [highlight=vb.net]
    Dim startInfo As New ProcessStartInfo("C:\Program Files\Counter-Strike Source\hl2.exe")
    startInfo.Arguments = "-nomaster -game cstrike -nojoy"
    Process.Start(startInfo)
    [/highlight]

    so..play around with it?...

    (c/p from post 3 pages back)
    Sorry but that's not what I'm looking for and I already know that.

    What I'm looking is for making a shortcut with an argument that is like in my first post.


    Status: Unknown

  4. #4
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Use the IWshRuntimeLibrary.

    Know Dot Net - Creating a Desktop Shortcut in .NET Code

    The example shows how to add args as well. No need for VB6 code. (Don't forget to include your references is the final release.)

    Although if you really want to use VB6 code here's how:

    [highlight=vb.net]
    Public Shared Sub CreateShortcut(ByVal filePath As String, ByVal shortcutPath As String, ByVal args As String())
    Dim wshObj As Object = CreateObject("WScript.Shell")
    Dim shortcutObj As Object = wshObj.CreateShortcut(shortcutPath)
    shortcutObj.Arguments = """" + String.Join(""" """, args) + """"
    shortcutObj.TargetPath = filePath
    shortcutObj.WorkingDirectory = IO.Path.GetDirectoryName(shortcutPath)
    shortcutObj.Save()

    Runtime.InteropServices.Marshal.ReleaseComObject(s hortcutObj)
    Runtime.InteropServices.Marshal.ReleaseComObject(w shObj)
    shortcutObj = Nothing
    wshObj = Nothing
    GC.Collect()
    End Sub
    [/highlight]
    Last edited by Jason; 08-21-2011 at 10:34 AM.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  5. The Following User Says Thank You to Jason For This Useful Post:

    nathanael890 (08-21-2011)

  6. #5
    nathanael890's Avatar
    Join Date
    Aug 2008
    Gender
    male
    Posts
    158
    Reputation
    13
    Thanks
    46
    My Mood
    Bored
    Thanks Jason.

    Although this is the only code I need to set its arguments.
    Code:
    shortcutObj.Arguments = """" + String.Join(""" """, args) + """"
    Problem is solved..


    Status: Unknown

  7. #6
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by nathanael890 View Post
    Thanks Jason.

    Although this is the only code I need to set its arguments.
    Code:
    shortcutObj.Arguments = """" + String.Join(""" """, args) + """"
    Problem is solved..
    Yeah but I thought I may as well just write up an easy method for future readers

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

Similar Threads

  1. ARGUMENTS FOR ME ( VOJCOO )
    By vojcoo in forum Trade Accounts/Keys/Items
    Replies: 12
    Last Post: 09-16-2009, 03:31 PM
  2. Nifty Firefox shortcut
    By mostwanted in forum Programming Tutorials
    Replies: 6
    Last Post: 09-03-2008, 07:44 PM
  3. How to make a ShutDown ShortCut at your Desktop
    By Silk[H4x] in forum Programming Tutorials
    Replies: 3
    Last Post: 08-16-2008, 07:40 AM
  4. Replies: 29
    Last Post: 02-23-2008, 06:15 AM
  5. Replies: 1
    Last Post: 09-04-2007, 09:27 PM