How to add command line options to shortcut?

399,461

Solution 1

Have you tried to add in the Target field

"c:\path\to\exe\program.exe" -option1 -option2

Only the program path and name need to be enclosed in quotes.

Solution 2

Place the switches after the quotes.

Only the program path is kept in quotes due to spaces in the path. Something like My Documents will not resolve properly due to the space between the words, so quotes are needed. This is also why you probably won't find a program with multi-word switches (that are seperate) such as --example switch. You will usually see something like --example-switch instead because a space constitutes a separate program argument.

Solution 3

Your quotes are in the wrong place. The quotes only go around individual paths. So move your ending quote back to the end of program.exe and leave -option1 -option2 outside of the quotes.

Solution 4

You can also use shortcuts for direct access to a folder or a website.
Folder:
F:\CriticalFiles\MS_InternetAccess
Internet:
"C:\Program Files (x86)\Internet Explorer\iexplore.exe" "https://www.theguardian.com/world"
I use quotes around both arguments.
I am using these because Win10 seems to lose the start menu from time to time.

Share:
399,461

Related videos on Youtube

Karl Voigtland
Author by

Karl Voigtland

Updated on September 17, 2022

Comments

  • Karl Voigtland
    Karl Voigtland over 1 year

    How can I add command line options to an executable in a shortcut in Windows XP?

    For example in the shortcut properties in target I have:

    "c:\path\to\exe\pogram.exe"
    

    I want to add some options:

    "c:\path\to\exe\program.exe -option1 -option2"
    

    However when I do this I get an error saying that the name specified in the target box is not valid.

  • Karl Voigtland
    Karl Voigtland over 14 years
    Works, thanks! That is the power of superuser.com. Its faster than trying to google an answer.
  • BinaryMisfit
    BinaryMisfit over 14 years
    Can't believe I got an answer in before you
  • John T
    John T over 14 years
    I was answering a second question when my program went off, this one seemed easier but I was too late :(
  • Kate Barnett
    Kate Barnett about 11 years
    @KarlVoigtland Actually, the power of SU is that it often provides the best answer as the first search result when you do Google it.
  • handle
    handle almost 8 years
    Windows 7 strips the quotes and expands known executable paths. If you're trying to run CMD builtins (like piping) from a link, see superuser.com/questions/1089922/…
  • Hashim Aziz
    Hashim Aziz about 7 years
    Is there a list of all the possible arguments somewhere?
  • Hashim Aziz
    Hashim Aziz about 7 years
    Is there a list of all the possible arguments somewhere?
  • Paul Sinclair
    Paul Sinclair about 7 years
    @Hashim- The arguments would depend upon the program the shortcut is linking to. Check the documentation for your program to discover what arguments it will accept.
  • martineau
    martineau over 6 years
    @Hashim: "all the possible arguments" to what, cmd.exe? Here's a link to those.
  • Hashim Aziz
    Hashim Aziz over 6 years
    All the arguments/options that it's possible to pass to a program you want to run.