Putting a command line argument in a program shortcut

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
 
J

Jeff Johnson

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?
 
R

RvGrah

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?
 
J

Jeff Johnson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top