如何使Notepad ++像cmd中的常规记事本一样起作用?

问题描述:

我喜欢使用命令提示符来编写和编译Java。
要编写代码,请在cmd中输入以下内容:

I like using the command prompt to write and compile java. To write the code I enter this in cmd:

记事本MyJavaClass.java

notepad MyJavaClass.java

这将打开记事本,询问我是否要创建新文件(如果尚不存在)。
对我来说,问题是我喜欢使用notepad ++作为文本编辑器,因为它具有不错的功能。

This opens notepad and asks if I want to create new file (If it doesn't already exist). The problem for me is that I like using notepad++ as a text editor because it has nice features.

所以我的问题是:

如何做到这一点,以便可以在cmd中键入 notepad ++ MyJavaClass.java并打开notepad ++,可以进行编辑而不必键入notepad ++的完整路径?

我试图将notepad ++。exe文件简单地放在System32文件夹中,但cmd
无法识别该命令。

I tried to simply place the notepad++.exe file in the System32 folder, but cmd doesn't recognize the command.

很抱歉:)

在您的路径

在Windows中(使用GUI):

在开始菜单中,右键单击计算机,在左侧区域中选择高级系统设置,然后在弹出的窗口底部选择环境变量。

From the Start Menu, right-click Computer, select Advanced system settings in the left area, then select Environment Variables at the bottom in the window that pops up.

转到PATH用户变量,然后单击编辑,然后将您的路径添加到notepad ++的末尾。
例如:

Go to the PATH user variable and click edit, and append YOUR path to notepad++ to the end. For example:

C:\Program Files(x86)\Notepad ++;

别忘了分号!

在Windows中(使用以管理员身份运行的命令行)

仅在命令行会话期间设置:

To set only for the duration of command line session:

set PATH =%PATH% ; C:\程序文件(x86)\ Notepad ++;

要永久设置,请使用与上面相同的命令,但替换 set setx

To permanently set, use the same command as above but replace set with setx:

请注意,并非所有Windows发行版都附带使用setx,并且可以在此处进行手动安装。

Note that not all Windows distributions come with setx, and can be manually installed here.