Search code examples
c#cmdnotepad++

How to run c# code using notepad++?


I have trouble executing code that I have written in notepad++. As from what I have researched online, I should edit path in system variable to this C:\Windows\Microsoft.NET\Framework64\v4.0.30319. I have already changed it and it's still not working. After I type in test.cs, a windows form will pop up stating that windows can't open this file. Here is an image of my command line:

CMD Picture

Here is also the small code that I have written:

using System;

public class Test
{
    static void Main()
    {
        Console.WriteLine("***");
    }
}

Solution

  • After compiling your c# file, execute it by just typing the name in your command prompt. Don't use the extension again. Just type

    test
    

    after compiling successfully in your cmd prompt, and you'll be fine. You can also use

    test.exe
    

    to run it instead of just test.