- Back to Home »
- C#.NET »
- Executing C# program using Command prompt
Posted by :
Sudhir Chekuri
Wednesday, 30 December 2015
1. Open Notepad and write the above program 1.
2. Save it as First.cs in a folder location like C:\FolderName\FileName.cs.
cs is the extension of CSharp code files.
Example: E:\Examples\first.cs
3. Open Command prompt and find the location of file to execute using csc command.
Example if you save file :
type E: (Press Enter key to take to root folder of E drive)
E:\>cd Examples (Enter to enter into Examples folder using Change directory command)
E:\>Examples>csc first.cs (Enter to execute the file)
E:\>Examples>first (Enter to see the output)
2. Save it as First.cs in a folder location like C:\FolderName\FileName.cs.
cs is the extension of CSharp code files.
Example: E:\Examples\first.cs
3. Open Command prompt and find the location of file to execute using csc command.
Example if you save file :
type E: (Press Enter key to take to root folder of E drive)
E:\>cd Examples (Enter to enter into Examples folder using Change directory command)
E:\>Examples>csc first.cs (Enter to execute the file)
E:\>Examples>first (Enter to see the output)