Click here to Skip to main content
15,880,543 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing hotel management windows application, I have 2 main screens in same module, in which 1 main screen is for Front office and another main screen for House keeping (i.e., functionality is different but both looks alike). How to make my .exe or build open House keeping Screen or Front office screen by passing command line arguments. Is it possible give arguments during installation and make it open the given argument related screen, after installing the build?
Posted

1 solution

In Program.cs file

Change static void Main() to static void Main(string[] args)

You can then access command parameters that are passed to your program.

Start program like myprog.exe /help "hello my son" -Dance now

static void Main(string[] args)
{
  foreach (string arg in args)
  {
    Debug.WriteLine("Arg: " + arg);
  }
}


Will output:

/help
hello my son
-Dance
now

Hope you can use it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900