1

I am trying to make a C# application that takes command line arguments (username and password) and declares them both as variables, so I would give arguments Bob and 12345, and it would save Bob as variable: Username, and 12345 as variable: Password. How would I do this?

John Saunders
  • 160,644
  • 26
  • 247
  • 397

1 Answers1

4

You can do this using Command Line Arguments.

Example:

public static void Main(string[] args)
   {
       //The arguments are 0 and 1, for the first and second args.
       var username = args[0];
       var password = args[1];
   }
Christian Stewart
  • 15,217
  • 20
  • 82
  • 139