In addition to Answer 1:
Yes, you can use the methods
System.Console.Read
,
ReadLine
and
ReadKey
methods (
https://msdn.microsoft.com/en-us/library/system.console%28v=vs.110%29.aspx[
^]), but I would advise you to look at the professionally-written console-only utilities. You will find very few using interactive input, which work as a fully-fledged command interpreters, CMD.EXE is just one of them. The majority of the utilities, or any console-only applications,
never use interactive input
. This is done for a very good reason: if interactive input is really needed, for a "regular" application, a graphical UI is more suitable. So, interactive input in console-only application is just not needed and is generally inconvenient for a user. Your application is a typical example of such application.
Instead, such application provides
all the input in a command line. If some volume of data is too big for a command-line parameter, the file name parameter is used, so this portion of detail is supplied in a file. This is much more convenient for a user, because one little mistake won't spoil long input work. The command line is passed to the entry point arguments (
Main
method) or can be obtained from
System.Environment
:
https://msdn.microsoft.com/en-us/library/system.environment.commandline%28v=vs.110%29.aspx[
^],
https://msdn.microsoft.com/en-us/library/system.environment.getcommandlineargs(v=vs.110).aspx[
^].
For command line parsing, please see my article or another CodeProject work I recommended in this article:
Enumeration-based Command Line Utility[
^].
—SA