3.2. Do something (intro)

The main principle of NppExec is the same as Notepad++'es "Run..." command (F5): to execute a command given. Usually it means to run some program/tool with specified parameters which can be passed in a form of Notepad++'es environment variables. For example, it allows you to launch your current file in Internet Explorer or to compile your current file using certain compiler. NppExec provides additional abilities for this:

- it has a Console window to show the console program's output

- it allows you to execute several commands one after another

- it supports all Notepad++'es environment variables plus several own variables

- it has additional commands which allow you to do more than you expect :)

- it is cool :)

NppExec actually provides four different ways to execute some command(s):

  1. using NppExec's Console [3.5] - allows you to enter some command and execute it by pressing Enter;
  2. using the dialog "Execute NppExec Script..." [3.6] - allows you to enter several commands (which will be executed one after another) and to save these commands as NppExec's script;
  3. using NppExec's command "npp_exec <script>" - allows you to execute commands from existing NppExec's script [3.7];
  4. using NppExec's command "npp_exec <file>" - allows you to execute commands from existing text file [3.7].

By the way, NppExec uses the 3rd way (described above) for its menu items which allow you to execute some NppExec's script.

Remarks:

NppExec by itself understands only its own internal commands and environment variables. When you type another command, such as "copy", "cmd" or "calc", NppExec tries to run it as a child process - i.e. it performs CreateProcess(...) and waits until this process ends. (Note: NppExec ver. 0.6 RC3 introduces a new advanced option "ChildProcess_RunPolicy" that allows to modify this behavior. Refer to [4.4] for more details.)

When you type something like "npp_run cmd" or "npp_run calc", NppExec tries to run specified command (the argument of npp_run) as an external process - i.e. it performs ShellExecute(...) and does not care about this process.