简体   繁体   English

如何使用notepad ++运行c#代码?

[英]How to run c# code using notepad++?

I have trouble executing code that I have written in notepad++. 我在执行用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. 从我在网上研究的内容来看,我应该将系统变量中的路径编辑为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. 输入test.cs后,会弹出一个窗体,说明窗口无法打开此文件。 Here is an image of my command line: 这是我的命令行的图像:

CMD图片

Here is also the small code that I have written: 这也是我写的小代码:

using System;

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

After compiling you c# file, execute it by just typing the name in your command prompt. 编译c#文件后,只需在命令提示符下键入名称即可执行它。 Don't use extension again. 不要再使用扩展名。 Just type 只需输入

test

after compiling successfully in your cmd prompt, and you'll be fine. 在你的cmd提示符中成功编译后,你会没事的。 You can also use 你也可以使用

test.exe

to run it instead of just test. 运行它而不仅仅是测试。

As I can see from the image, don't type test.cs. 正如我从图像中看到的那样,不要输入test.cs. Instead type test and it will execute. 而是键入test并执行。 test.cs is ac# prograram file and it can be opened in visual studio or notepad or can be compiled but can't be executed. test.cs是ac#prograram文件,它可以在visual studio或notepad中打开,也可以编译但不能执行。 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. 编译将test.exe作为输出并运行test.exe您可以提到test.exe或只是测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM