How to make notepad++ function like regular notepa

2019-07-06 20:52发布

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

notepad MyJavaClass.java

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.

So my question is:

How do I make it so that I can type "notepad++ MyJavaClass.java" in cmd and have notepad++ open up, ready for editing without having to type the full path of notepad++?

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

Sorry for the noobiness :)

3条回答
一纸荒年 Trace。
2楼-- · 2019-07-06 21:28

Notepad++ is a known app, so if you launch it with the START builtin, it'll work without having to modify the PATH.

start notepad++ MyJava.java
查看更多
Fickle 薄情
3楼-- · 2019-07-06 21:32
HKEY_CURRENT_USER\Software\Microsoft\Command Processor
Autorun 
path %userprofile%\desktop;%path%&doskey /macrofile="%userprofile%\macros.txt"

Here I'm adding a path, then setting the doskey macros.

You could do this

doskey /macrofile="%userprofile%\macros.txt"

In the macros.txt do this

n="c:\somewhere\notepad++.exe" $*

Now you just type

n <filename>

See

set /?
doskey /?
cmd /?
查看更多
叼着烟拽天下
4楼-- · 2019-07-06 21:47

Add notepad++ to your path

In Windows (Using 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.

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++\notepad++.exe;

Don't forget the semi-colon! Be sure the entry before it is also ended with a semi-colon.

In Windows (Using command line running as Administrator)

To set only for the duration of command line session:

set PATH=%PATH%;C:\Program Files (x86)\Notepad++;

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

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

查看更多
登录 后发表回答