none
Combining commands in cscript .argument RRS feed

  • Question

  • I am a novice at this, so please forgive me if the below isn't up to standards.  I have the following .vbs file that I am running with cscript to create a desktop shortcut.

    set WshShell = WScript.CreateObject("WScript.Shell" )
    strDesktop = WshShell.SpecialFolders("Desktop" )
    set oShellLink = WshShell.CreateShortcut(strDesktop & "\FCIV.lnk" )
    oShellLink.Arguments = "/k  ""C:\Program Files (x86)\FCIV\FCIV.exe ""/? "
    oShellLink.WindowStyle = 1
    oShellLink.IconLocation = "C:\Windows\System32\Shell32.dll,22"
    oShellLink.Description = "FCIV"
    oShellLink.WorkingDirectory = "C:\Program Files (x86)\FCIV"
    oShellLink.Save

    What I can't figure out is how to combine the oShell.Link.Arguments line with the mode command.  I am trying to do something like this:

    oShellLink.Arguments = "/k  ""C:\Program Files (x86)\FCIV\FCIV.exe ""/? " "&& " "/k ""mode con: cols=80 lines=50 "

    I've tried a few different combinations of things and tried to use AND also, but can't seem to get it to work.

    Any ideas.

    Thanks to all for your help.

     

    Wednesday, February 19, 2014 7:36 PM

Answers

All replies

  • Documentation is here:

    http://msdn.microsoft.com/en-us/library/xk6kst2k.aspx

    The answer: Do not put the path to the executable in the Arguments property.

    Set TargetPath property to the executable, and set Arguments property to the arguments for the executable.

    The documentation spells all of this out.

    Bill

    Wednesday, February 19, 2014 8:08 PM
    Moderator
  • Thanks Bill

    Unfortunately, in this case, it seems my Argument is a path to the executable i.e the CMD /K takes the path to the FCIV.exe application.  But I'll keep trying things to see if I can get the TargetPath to accept the /K <path>

    Thursday, February 20, 2014 4:16 PM
  • Put you commands in a batch file and use the link to call the batch file.  What you are trying to do is not really supported in a shortcut.


    ¯\_(ツ)_/¯

    Thursday, February 20, 2014 4:37 PM
  • But I'll keep trying things to see if I can get the TargetPath to accept the /K <path>

    That's not going to work.

    You can do one of two things:

    1. Set TargetPath to cmd.exe and set Arguments to the rest of the command line.

    2. Create a shell script (.bat or .cmd file) that contains the commands and set TargetPath to the shell script.

    Bill

    Thursday, February 20, 2014 5:18 PM
    Moderator