In the answer above you were given a code, even two times (I will not repeat it), how to take command line parameters and process them in a console application. The bottom line is that you call your application, and in the call string you pass them to the application through the string array args .
After you have received the necessary parameters, in your example the name of the site, your application performs the necessary actions and terminates. Upon completion, you can specify an integer ( int ) return code, also known as ExitCode , which can be processed in the calling application. Those. true or false as you want, return does not work, but 0 or 1 (or some other type of int ) - easily.
You can return by overriding the Main() method in a console application, replacing void with an int , like this:
static int Main(string[] args) { int i = 0; Console.WriteLine("Hello! I'll try to write command-line arguments."); foreach (var parameter in args) { Console.WriteLine("Parameter " + i.ToString() + " is: "+args[i]); } Console.WriteLine("Press ENTER to exit"); Console.ReadLine(); return args.Count(); }
In this code, the program can receive some command line arguments as input, and tries to display them on the console screen, then terminates with a return code equal to the number of arguments.
In addition, you can get the same result (application termination with a return code) using the Environment.Exit(code) ( MSDN ) method, which allows you to complete the work not only at the end of the Main() method, but also from another place in the program. You can try instead of return args.Count(); write like this: Environment.Exit(args.Count()); (just back void instead of int ).
A slightly modified and more flexible option for solving your task will use some kind of buffer (or buffers) for data exchange, for example, files: we run the program and as a command line argument you give it the file name with some input data, and the name of the file where the result will be displayed. The program processes the input data, with their account it performs some actions, and the result is written in the desired form into the output file, which can then be processed as you like.
There are various tools for working with files in the C # arsenal, and talking about all the possibilities of how to write / read a file is too long and too much, but you can read about it, for example, here , or here , or here . Or google and find more sources)