43

How can I specify the actual file to process using the Run command in Notepad++. I want for example run pdflatex using the actualfile as input, or the cs compiler, etc. Using the entire path isn't practical, it must works with any actual file.

1
  • Could you please expand a bit on your approach. I am interested in setting up Notepad++ properly. Thanks Commented Jul 30, 2015 at 13:49

1 Answer 1

57

You can automatically add the current file using a variable in the execution string:

C:\temp\test.exe "$(FULL_CURRENT_PATH)" 

The list of available variables is documented here. Examples:

  • FULL_CURRENT_PATH = E:\My Web\main\welcome.html
  • CURRENT_DIRECTORY = E:\My Web\main
  • FILE_NAME = welcome.html
  • NAME_PART = welcome
  • EXT_PART = .html
  • SYS.<var> e.g.: SYS.PATH = %PATH%
  • CURRENT_WORD = <selection or word under cursor>
  • CURRENT_LINESTR = <text of the line line under cursor>
  • CURRENT_LINE = <line number>
  • CURRENT_COLUMN = <column number>
  • NPP_DIRECTORY = c:\Program Files\notepad++
  • NPP_FULL_FILE_PATH = c:\Program Files\notepad++\notepad++.exe

You can also see the source code at RunDlg.cpp line 77 and line 26

Sign up to request clarification or add additional context in comments.

6 Comments

Is there a way to get several open files in Npp to run a compare program for example?
NPP should have this list or a link to the docs in the Run... dialog.
@sinsedrix You could have a "Mark for comparison" command that saves the file path to some environment variable like %NPP_COMPARE% and a second command like "Diff with marked" that would do diff "$(SYS.NPP_COMPARE)" "$(FULL_CURRENT_PATH)"
Btw using this with HxD is a great way to add Hex Editor support to NPP.
EXT_PART actually includes the dot; it should be .html here. (Edit queue is full :/ )
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.