Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute commands with notepad++

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.

like image 768
mjsr Avatar asked Jan 06 '11 11:01

mjsr


People also ask

How do I run a command in Notepad++?

How to run CMD console commands in Notepad++ If you want to work with Notepad++ and CMD (Command Line) Console at once you can install NPPExec plugin. Once you install this plugin using Plugin Manager, go to Plugins -> NppExec -> Execute..., or press F6 key.

How do I run a .txt script?

Right click on the text file, select properties, select permission, mark the "Let this file be executed" text box. Now you can execute it just by double clicking on the file.


1 Answers

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_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

like image 102
Robert Avatar answered Oct 20 '22 03:10

Robert