When I open files from the command line without a full path and then change directories and try to open some more notepad++ becomes confused and says it can't open the file. Also if I have a file opened from the command line without a full path and then open a file from the GUI it gets confused and says the 'non-path' file doesn't exist anymore.
Any work around for this?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you are looking for a solution how to execute *.cmd files.
1. Edit the file shortcut.xml.
- Path
C:\Documents and Settings\%user%\Application Data\Notepad++\shortcuts.xml
- Insert
<Command name="launch CMD" Alt="yes" Key="67">cmd.exe /K "$(FULL_CURRENT_PATH)"</Command>
- or if you like the cmd in color just Insert
<Command name="launch CMD" Alt="yes" Key="67">cmd.exe /t:ce /K "$(FULL_CURRENT_PATH)"</Command>
- Save the file
2. Close an reopen your editor
3. open your *.cmd (the file you work on)
4. Go to execute --> lauch CMD (Your *.cmd file will be executed in a cmd window)
marol
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The command line must specify the entire file location when sending it to notepad++. One batch file command line which does this is
C:\Progra~1\notepad++\notepad++ %~f1
This assumes notepad++.exe is located in C:\Program Files\notepad++.
The %~f1 tells the command processor to use the full file name of the argument, including the path. Put this command in a .bat file somewhere it can be found (along the environment path) and it will cause notepad++ to use the correct location of the file. The only downside to using a batch file is the command line is captured by running notepad++ and does not free up until notepad++ closes. You can open a second command window and use it to run a compiler to process the file just edited and saved even though notepad++ is still open with it. For example: store the above line in a file called ed.bat (in the environment path). Then to edit myfile.xxx with notepad++, type "ed myfile.xxx" from within the directory where myfile.xxx is located.
Dave A.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Update on using a .bat file to start notepad++. My previous and following methods run correctly on WinXP.
Enter the following line into a .bat file which is in your environment path, such as C:\ed.bat:
start C:\Progra~1\notepad++\notepad++.exe %~f1
The start command initiates notepad++ with the file you specify. To use the command on myfile.java from the directory where myfile.java is located, type:
ed myfile.java
The path to the file will be supplied to notepad++ as an input parameter. The start command lets the command line release from notepad++ instead of waiting for it to terminate. This removes the downside mentioned in my previous message. Now the command line can be used to assemble or compile a file while notepad++ is running.
Dave A.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You can run that command line with the "Run..." command under the Run menu. You can bind that command to a shortcut key sequence by clicking the "Save..." button on the Run dialog.
You may need to run two separate commands, one to compile your Java code, the other to run it when it compiles without errors. --Joel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I know how to setup that, but i was wondering if there is shortcut that i press Ctrl something and it will come out the cmd with the answer directly. because there was a shortcut for compiling java in the older version. Anyway, thanks for your reply.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When I open files from the command line without a full path and then change directories and try to open some more notepad++ becomes confused and says it can't open the file. Also if I have a file opened from the command line without a full path and then open a file from the GUI it gets confused and says the 'non-path' file doesn't exist anymore.
Any work around for this?
In my case (using NP++ version 4.0.1 under Windows XP) it even fails when I try
C:\>"C:\Program Files\Notepad++\notepad++.exe" c:\test.txt
or
C:\>"C:\Program Files\Notepad++\notepad++.exe" "C:\test.txt"
NP displays the message
C:\test.txt doesn't exist. Create it?
NP++ looks great, but I would like to be able to open a file from the command line.
Best regards
Maarten
If you are looking for a solution how to execute *.cmd files.
1. Edit the file shortcut.xml.
- Path
C:\Documents and Settings\%user%\Application Data\Notepad++\shortcuts.xml
- Insert
<Command name="launch CMD" Alt="yes" Key="67">cmd.exe /K "$(FULL_CURRENT_PATH)"</Command>
- or if you like the cmd in color just Insert
<Command name="launch CMD" Alt="yes" Key="67">cmd.exe /t:ce /K "$(FULL_CURRENT_PATH)"</Command>
- Save the file
2. Close an reopen your editor
3. open your *.cmd (the file you work on)
4. Go to execute --> lauch CMD (Your *.cmd file will be executed in a cmd window)
marol
edut the environment variable PATH like
PATH=%PATH%;"c:\program files\notepad++"
Then you can start from command line with
notepad++ c:\helloword.txt
The command line must specify the entire file location when sending it to notepad++. One batch file command line which does this is
C:\Progra~1\notepad++\notepad++ %~f1
This assumes notepad++.exe is located in C:\Program Files\notepad++.
The %~f1 tells the command processor to use the full file name of the argument, including the path. Put this command in a .bat file somewhere it can be found (along the environment path) and it will cause notepad++ to use the correct location of the file. The only downside to using a batch file is the command line is captured by running notepad++ and does not free up until notepad++ closes. You can open a second command window and use it to run a compiler to process the file just edited and saved even though notepad++ is still open with it. For example: store the above line in a file called ed.bat (in the environment path). Then to edit myfile.xxx with notepad++, type "ed myfile.xxx" from within the directory where myfile.xxx is located.
Dave A.
Update on using a .bat file to start notepad++. My previous and following methods run correctly on WinXP.
Enter the following line into a .bat file which is in your environment path, such as C:\ed.bat:
start C:\Progra~1\notepad++\notepad++.exe %~f1
The start command initiates notepad++ with the file you specify. To use the command on myfile.java from the directory where myfile.java is located, type:
ed myfile.java
The path to the file will be supplied to notepad++ as an input parameter. The start command lets the command line release from notepad++ instead of waiting for it to terminate. This removes the downside mentioned in my previous message. Now the command line can be used to assemble or compile a file while notepad++ is running.
Dave A.
anyone knows how to compiles and run the java files directly from the NOTEPAD++ without going to cmd.
thanks
You still need the command line.
You can run that command line with the "Run..." command under the Run menu. You can bind that command to a shortcut key sequence by clicking the "Save..." button on the Run dialog.
You may need to run two separate commands, one to compile your Java code, the other to run it when it compiles without errors. --Joel
This might help.
http://notepad-plus.sourceforge.net/uk/run-HOWTO.php
--Joel
I know how to setup that, but i was wondering if there is shortcut that i press Ctrl something and it will come out the cmd with the answer directly. because there was a shortcut for compiling java in the older version. Anyway, thanks for your reply.