title: Implementing a command line interpreter
body: <p>In terminal or cmd, you can write commands, in which there is a main command and then sub-commands, or arguments and stuff...like this:</p>
  
  <pre><code>cd Desktop\Folder
  lst
  Format E: /fs:FAT32
  </code></pre>
  
  <p>I want to create a C# console application that could execute predefined commands like this, but which could also split up main commands and sub-commands, in which some could be optional and some not. I have tried just taking all as string and then splitting it to array and creating <code>if(s)</code> and <code>switch</code> and <code>case</code>s, but it looks really bad and hardly manageable. I'm sure that in the OS's terminal or cmd it's build in another way. Could you help me understand the basic structure of such an application? </p>