title: Running R via terminal in Windows and leaving R session open
body: <p>Suppose that I have a R script called <code>test.R</code>, stored at <code>C:\</code>, with the following content:</p>
  
  <pre><code>x &lt;- "Hello Stackoverflowers"
  print(x)
  </code></pre>
  
  <p>To run it via terminal one could simply call:</p>
  
  <pre><code>Rscript C:\test.R
  </code></pre>
  
  <p>And as expected, the result will be:</p>
  
  <p><a href="https://i.stack.imgur.com/la7EX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/la7EX.png" alt="enter image description here"></a></p>
  
  <p>However, what I wonder is whether there is a way to run <code>test.R</code> via Windows console but after that staying within the executed R session instead of closing and going back to the console cursor? That is, staying inside the R session instead of going back, in the image above, to <code>C:\R\R-3.4.1\bin&gt;</code>.</p>
  
  <p>For instance, when compiling Python code with <code>python.exe</code> I can easily accomplish a similar thing by passing the <code>-i</code> parameter to the <code>python.exe</code>call.</p>
  
  <p>How could I do that with R?</p>