122

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.

Vadzim
  • 1,270
  • 14
  • 18
Karl Voigtland
  • 1,351
  • 2
  • 8
  • 6

4 Answers4

149

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.

psicomante
  • 103
  • 3
BinaryMisfit
  • 20,643
  • 10
  • 67
  • 76
  • 1
    Windows 7 strips the quotes and expands known executable paths. If you're trying to run CMD builtins (like piping) from a link, see http://superuser.com/questions/1089922/cmd-command-redirection-pipes-in-link-on-windows-7/1089923 – handle Jun 16 '16 at 08:50
  • 1
    Is there a list of all the possible arguments somewhere? – Hashim Aziz Mar 13 '17 at 23:35
  • 2
    @Hashim: "all the possible arguments" to what, `cmd.exe`? [Here's](https://ss64.com/nt/cmd.html) a link to those. – martineau Oct 13 '17 at 22:46
  • All the arguments/options that it's possible to pass to a program you want to run. – Hashim Aziz Oct 13 '17 at 22:49
  • Also: Watch out for non-printable characters from copy-pasting. If the Target does not work for some reason, just make sure all "space" characters are actual spaces and not something else. – Niko Föhr Apr 07 '23 at 14:52
16

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.

John T
  • 163,373
  • 27
  • 341
  • 348
5

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.

Ryan Bolger
  • 3,471
  • 20
  • 20
2

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.

pfabri
  • 113
  • 5