Reputation: 1570
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 :)
Upvotes: 9
Views: 19913
Reputation: 1
In an elevated command prompt, make a link named whatever you want inside AppData\Local\Microsoft\WindowsApps
to the Notepad++ executable:
mklink "%LOCALAPPDATA%\Microsoft\WindowsApps\npp.exe" "C:\Program Files\Notepad++\notepad++.exe"
That location is in the user's default path.
Upvotes: 0
Reputation: 17254
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
Upvotes: 4
Reputation: 1967
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.
Upvotes: 19
Reputation: 4142
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
Upvotes: 27
Reputation:
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 /?
Upvotes: 1