Unknown
Unknown

Reputation: 73

Best way to pass command line arguments between processes

I developed a c# single instance application. I want to pass the command line arguments of the second instance to the already running instance before the second instance kills itself. Is there any simple way to do this ?

Upvotes: 0

Views: 194

Answers (1)

code4life
code4life

Reputation: 15794

There's so many ways to do this, IMHO.

A quick and dirty way would be to anonymous pipes. Just before you quit the second instance, you could make a call over the pipes, passing the command line args (maybe do a string.Join(new []{','}, args) to concatenate them first).

There's so many other ways to do inter-process communications though.

A very simplistic example of anonymous pipes usage is give on MSDN: https://msdn.microsoft.com/en-us/library/bb546102(v=vs.110).aspx

HTH.

Upvotes: 3

Related Questions