Running C# Code Using Command Prompt

Using Command Prompt to Compile C# Program:

Its easy to compile and run C# code from Command Prompt, Learn here step by step:

  • Write a C# Program
  • Copy it on Notepad as given Picture
  • Save it as a .cs file as given in picture, I am saving it on Desktop.

  • Go to to Visual Studio Command Prompt.

  • Write cd.. and press enter to go one directory back, and keep doing it until you reach C:/ Drive
  • Now cd (directory name inside C:/) to go there for example "cd Users".
  • I went to Desktop as i stored .cs file on desktop
  • now write "csc faisal.cs" on command prompt to compile your file.
  • .exe file is made on your desktop, Run and Enjoy

Thank You for Reading, Like this if tou understood, It Helps a lot