<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML lang="en">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<link href="style.css" rel="stylesheet" type="text/css">
<title>4.6.9. Send several commands to external tool</title>
<script src="show_matches.js" type="text/javascript"></script>
</HEAD>
<BODY>
<h3>4.6.9. Send several commands to external tool</h3>

<p>A piping technique can be used to send several commands to external tool.</p>
<p>Let's take the standard &quot;cmd&quot; as an example. Let's assume you have a text file with a list of commands you want cmd to execute. Let's name this file &quot;c.txt&quot; and have the following lines in it:</p>
<blockquote>
  <pre>ECHO Let's execute DIR command...
DIR
ECHO Done!
ECHO Now let's see some help for CD command...
CD /?
ECHO Done!

</pre>
</blockquote>
<p>Note: Don't forget to press Enter to have end-of-line (CR/LF) after the very last line! As far as I understand, the last command (&quot;ECHO Done!&quot; in our case) may be incorrectly understood if there's no new line after it.</p>
<p>Now execute the following from NppExec's Console:</p>
<blockquote>
  <pre>cmd /C type c.txt | cmd</pre>
</blockquote>
<p>I believe the same technique should work with external tool as well - e.g.:</p>
<blockquote>
  <pre>cmd /C type c.txt | external_tool</pre>
</blockquote>
<p>unless the external tool itself does not accept piping. But generally this approach should work.</p>

<p>See also: Using cmd.exe <a href="4.4.html">[4.4]</a>.</p>

</BODY>
</HTML>
