Reputation: 333
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:
Here is also the small code that I have written:
using System;
public class Test
{
static void Main()
{
Console.WriteLine("***");
}
}
Upvotes: 3
Views: 21786
Reputation: 1398
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.
Upvotes: 10
Reputation: 733
As I can see from the image, don't type test.cs. Instead type test and it will execute. test.cs is a c# prograram file and it can be opened in visual studio or notepad or can be compiled but can't be executed. It can be executed only after compilation. Compilation will give test.exe as an output and to run test.exe you can mention either test.exe or just test.
Upvotes: 5