0

I have a solution which has WPF project and some console applications in it. WPF project is the start up but I need to get the command line arguments from one of the other projects. Is there any way to do that?

When I use Environment.GetComamndLineArguments() function it gives me the directory of the solution file.

Please help me if there is a way to do that?

ali samil
  • 1
  • 2
  • WPF is the start up but you need the argumens of the other..? What are you rying to accomplish? What are the console applications doing during the runtime of the WPF application? – Ric .Net Dec 08 '14 at 10:36
  • Possible duplicate: http://stackoverflow.com/questions/2633628/can-i-get-command-line-arguments-of-other-processes-from-net-c – Barracoder Dec 08 '14 at 10:52

1 Answers1

0

When using Environment.GetCommandLineArgs(), the first variable will be the executable name. The following parameters will be the actual arguments.

If you want to pass command line arguments between applications, you could use Process.Start, passing the arguments in there to the other application (which you start then):

Process.Start("x.exe", "argument1 argument2");

If you want to make calls to running applications, take a look at What is the best choice for .NET inter-process communication?.

Community
  • 1
  • 1
Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325