Passing command line arguments to gnuplot in Windows
<p>I have a Fortran 90 program that outputs some data to a .txt file.
The data is to be plotted with gnuplot.</p>

<p>I was able to launch gnuplot with</p>

<pre><code>CALL SYSTEM("start wgnuplot")
</code></pre>

<p>which is equivalent to type </p>

<pre><code>start gnuplot 
</code></pre>

<p>in the Windows command line prompt. </p>

<p>But then, I would like to have the program telling gnuplot what to do next, i.e., changing directory to the right one, and plotting my file.txt.</p>

<p>All in all this boils down to a simpler question:</p>

<p>How do I pass a command line in Windows that launches gnuplot and gives it some additional commands?</p>

<p>I tried to do that with something even easier like plotting y=x.
In a normal gnuplot windows this is just plot x.</p>

<p>From the cmd.exe (which is what is called by Fortran's CALL SYSTEM()  )I've tried:</p>

<pre><code>start wgnuplot plot x
start wgnuplot plot x -pause
start wgnuplot plot x -persist
start wgnuplot plot x -noend
start wgnuplot plot x /noend
</code></pre>

<p>And others, including every possible variant with or without quotation marks, for instance</p>

<pre><code>start wgnuplot "plot x -persist" 
</code></pre>

<p>etc.</p>

<p>So far the only one that works is the basic</p>

<pre><code>start gnuplot
</code></pre>

<p>Which starts gnuplot indeed. But then I don't know how to add the next commands. Once I have a working command line input I believe I will just have to plop it into the CALL SYSTEM argument to have my Fortran program doing all the work. </p>

<p>I could only find instructions on how to achieve this on a UNIX-like machine, but not on Windows.
Any help would be appreciated.</p>

<p>Background info: Windows 8, Code::Blocks, gnuplot 5.0 patchlevel 1</p>