I'm running Windows and missing vim; is it possible to use Notepad++ to run a command from the Windows command prompt and place the output in a notepad++ buffer?


It seems to be me the original Q is about Notepad++ supporting something similar to vi's ability to read the output (stdout) of a shell command into the current doc (general buffer in vi termonology),

vi Example

:r! ls


: ( ex line editor command ) r ( read ) ! ( from the shell, the output (stdout) of the command ls into the current doc ( nothing specified, default is to read into general buffer )

Notepad++ v 7.7.1 ( 32-bit ) Example


or navigate menu system, Run menu to Run.. menu-item

Enter the desired command into the textbox of the notepad++ Run dialog,

cmd.exe /c echo %DATE% | clip

Press ENTER key or Click Run button

Ctrl+V contents of clipboard into Notepad++ document.

  • This is plagiarism. Your answer cmd.exe /c echo %DATE% | clip is exactly like Martin Valach's answer months ago. It's also similar to Klitos Kyriacou's comment last year. Besides, it's in no way the best way to achieve the purpose as you still need to Ctrl+V – phuclv Aug 1 '19 at 0:13

Is it possible to use Notepad++ to run a command from the Windows command prompt and place the output in a Notepad++ buffer?

As far as I am aware, not directly. That said, a batch file might help in this case e.g.:

@rem Redirects both STDOUT and STDERR to e.g. cli_tmp.txt
%* > C:\temp\cli_tmp.txt 2>&1 
"C:\Program Files (x86)\Notepad++\notepad++.exe" C:\temp\cli_tmp.txt

If you save this as ex. open_npp.bat and register it in your Windows Path, you could then use ex.:

open_npp echo hello

at a command prompt and the text output from echo hello (i.e. hello) would appear in a new Notepad++ tab labeled as cli_tmp.txt. Furthermore, you could use the Notepad++ Run... menu item to execute cmd /k open_npp echo hello to get the same effect as running open_npp echo hello from the command line.


  • The biggest drawback to this approach is that you'll likely want to copy the output or re-save your temp document with a different title each run, as your output will be typically overwritten each time the batch file is called.

  • As is, in the batch example given, output from STDERR is written to the temp file (vs. console) and the command window is closed immediately upon completion (exit()). However, this behavior can obviously be changed.

  • This method likely won't catch interactive command input/output properly. Likewise, if a process hangs or takes forever, you might be stuck guessing about what's happening.

  • I have never had an issues using this kind of batch file but there could always be edge cases. =P


In Notepad++ Console window is possible to execute a shell command and redirect the output into clipboard buffer.

For example, to copy current date and time into clipboard:

cmd /c Echo %DATE% %TIME% | clip

You can use pork2sausage. Just open Plugins Admin in newer Notepad++, or install Plugin Manager in older versions, then install the plugin from there. Otherwise go to the Plugin Central and download the zip file manually

The plugin transforms a selected text to whatever you want, once your transformer (a console program which takes inputs then generates an output) is set properly with Pork to Sausage plugin.

The attractive part of this plugin is its flexibility: one (or more) small program(s) can be written in any language (such in java or .Net), or usage of the other programs in order to transform your selected text in Notepad++.

Up to 20 commands are customizable.

Plugin Central

After installing open Plugins > Port to Sausage > Edit user commands and add whatever command you want. Here's an example to convert the selected text to uppercase (of course in reality you should use the built-in case conversion from Notepad++)

progCmd=cmd /c "echo $(SELECTION) | tr [:lower:] [:upper:]"

However to make the above example work with new lines you need to add 2 more options progInput and progOutput. You can also prevent the output to overwrite the selected text with replaceSelection. You can find more information in the plugin's comment


No. What you can do is install Vim or Emacs on Windows. You can also write commands in Notepad++ and save to a batch file (.bat); double-clicking that should run the commands.

  • No are you sure? Provided that Notepad++ has strong plugin support – phuclv May 2 '19 at 4:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.