title: Multiple shell commands in Windows
body: <p>I'm trying to replicate a shell command in R and cannot figure out how to string commands together.  This just returns the contents of the working folder (<code>system()</code> fails for some reason):</p>
  
  <pre><code>&gt; shell("dir")
   Volume info ..
   Directory of E:\Documents\R
   contents are listed..
  </code></pre>
  
  <p>Now lets try and navigate to C drive and run <code>dir</code> (without using the obvious <code>dir C:</code>)..</p>
  
  <pre><code>&gt; shell("cd C:")
  C:\
  &gt; shell("dir")
   Volume in drive E is GT
   etc..
  </code></pre>
  
  <p>So it seems commands can't be entered separately as the shell doesn't remember the working directory. So..</p>
  
  <pre><code>&gt; (cmd = "cd C:
  + dir")
  [1] "cd C:\ndir"
  &gt; shell(cmd)
  C:\
  </code></pre>
  
  <p>No luck as the C: folders are not reported. Other methods I've tried also fail. Grateful for any ideas.</p>