Putting a command line argument in a program shortcut

  • Thread starter Thread starter RvGrah
  • Start date Start date
R

RvGrah

If I add "string[] args" to the Program.cs file so that there can be
arguments passed when the program launches, how do I add those to a
fixed desktop shortcut on my users' machines? And If I'm launching
said program from a System.Diagnostics.Process.Start line of code how
would I do it there? OK, I could probably figure out that second one
myself but I haven't been able to search and find an answer on the
first question.

Bob
 
If I add "string[] args" to the Program.cs file so that there can be
arguments passed when the program launches, how do I add those to a
fixed desktop shortcut on my users' machines? And If I'm launching
said program from a System.Diagnostics.Process.Start line of code how
would I do it there? OK, I could probably figure out that second one
myself but I haven't been able to search and find an answer on the
first question.

Well, what are you using to create this shortcut?
 
For the purpose of testing and development, just right-clicking the
exe and choosing "Create Shortcut".

I figured out what I was doing wrong, I was thinking there'd have to
be a switch, like a dash or slash, but in fact all you do is leave a
space after the path and then add your argument as plain text, no
quotes, in the "Target" box. Turned out to be the only syntax
variation I hadn't tried!

As I thought figuring how to launch it from Process.Start was very
easy, just put a comma and the overload list tells you what it wants
next.

Thanks guys.

If I add "string[] args" to the Program.cs file so that there can be
arguments passed when the program launches, how do I add those to a
fixed desktop shortcut on my users' machines? And If I'm launching
said program from a System.Diagnostics.Process.Start line of code how
would I do it there? OK, I could probably figure out that second one
myself but I haven't been able to search and find an answer on the
first question.

Well, what are you using to create this shortcut?
 
I figured out what I was doing wrong, I was thinking there'd have to
be a switch, like a dash or slash, but in fact all you do is leave a
space after the path and then add your argument as plain text, no
quotes, in the "Target" box.

Well, if your argument contains spaces then you SHOULD put quotes around it.
 
Back
Top