How to Open C# .exe with a Parameter

I've made a simple C# exe which I open via a .bat file in the event a user tries to open a second instance of an application on their workstation. The exe tells the user thay already have an instance open.

I would like to pass a parameter to the .exe (the user's ID).

Now I open the .exe from the batch file simply with the line:

kcec.exe

Is there a way I can open it passing a parameter, say :

kcec.exe ("userabc")

Many thanks
Mike Thomas





Answer this question

How to Open C# .exe with a Parameter

  • capere

    kcec.exe agr1 age2 agr3 "agr 4"

    the result will be in

    String []args;

    args = Environment.GetCommandLineArgs();



  • How to Open C# .exe with a Parameter