How to make notepad++ function like regular notepad in cmd?

15,751

Solution 1

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++;

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.

Solution 2

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

Solution 3

Sidestepping the question slightly, I made a Windows batch file to give command-line access to Notepad++. Rather than add to the PATH pigpile, I put an npp.bat file in a tools directory that is already in the path.

"C:\Program Files (x86)\Notepad++\notepad++.exe" %*

Then from any command line:

npp foo.java
Share:
15,751
Dziugas
Author by

Dziugas

Updated on July 02, 2022

Comments

  • Dziugas
    Dziugas almost 2 years

    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 :)