deodorant

Hello,

How would I go about adding an argument into a command line at runtime I have a console project that runs off of command line arguments, but I can't figure out how to edit/set them at run time from another project. That might sound a bit confusing, but here's what I need to be done:

1) Copy a file from one location to another.
2) Set an argument into the copied file from my other project.
3) Launch the copied file.

Thanks.




Re: Visual C# Express Edition Command lines...

ahmedilyas

sorry can you explain more which application is this which argument/command line are you wanting to set for which application




Re: Visual C# Express Edition Command lines...

deodorant

Sure I can, sorry I wasn't clear before.

Just to clear things up, when I say "command line argument" I'm talking about when you create a shortcut of a file, Right click-> properties-> and put text in the target textbox. ("Location.exe" +argument)

I wrote a console application that runs based on what argument it reads. My question is, how can I set that argument to the console application from another project while it's not running So that it's defaulted to start with the same argument evertime






Re: Visual C# Express Edition Command lines...

jrboddie

Have you tried this

System.Diagnostics.Process.Start("someProgram.exe argument");




Re: Visual C# Express Edition Command lines...

deodorant

Nope... becuase I'm trying to set the arguments without launching the file. The user can later launch the file as if it's a shortcut on the desktop.




Re: Visual C# Express Edition Command lines...

jrboddie

So how about making an executable program which does nothing but call the program (with the desired arguments using the command I suggested)   Then the user runs the new program and the arguments are hidden.

If you wanted another program to set the arguments, you could have it write the arguments to a file which is read by the second program before calling the target program.

   Program A sends arguments to argFile

   User runs Program B from desktop which reads argFile and calls Program C +args

Perhaps I don't fully understand what you are trying to do.