Get the command line

There are two ways to get the command line.

string commandLine = System.Environment.CommandLine;

This property contains the entire (full) command line.

or use:

string[] commandLine = System.Environment.GetCommandLineArgs();

The first array element contains the executable (may include the path)
The other array elements the arguments. They are separated by spaces.

Leave a Reply

Your email address will not be published. Required fields are marked *