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.

Lastest update in May 2011, inital post in May 2011

Write a comment

I appreciate comments, suggestions, compliments etc. Unfortunately I have no time to reply to them. Useful input will be used for sure!