title: Running R from cmd in windows
body: <p>I'm trying to install rtools, so that I can install another package (Google's causalimpact)  and the process has indicated I have a problem with my path environment for R. </p>
  
  <p><strong>Main issue</strong></p>
  
  <p>I can't run <code>R</code> from the cmd window.</p>
  
  <p>The expected behaviour is to output below and give <code>&gt;</code> prompt:</p>
  
  <pre><code>R version 3.1.1 (blah blah)
  
  ...
  
  Type 'demo()' for some demos, 'help()' for on-line help, or
  'help.start()' for an HTML browser interface to help.
  Type 'q()' to quit R.
  </code></pre>
  
  <p>However the actual result is:</p>
  
  <pre><code>'C:\Program' is not recognized as an internal or external command,
  operable program or batch file.
  </code></pre>
  
  <p><strong>Additional info</strong></p>
  
  <p>I can however run <code>Rcmd</code> and <code>Rgui</code> (everything apart from <code>R</code>) from cmd without error. </p>
  
  <p><code>Where R</code> prints output <code>C:\Program Files\R\R-3.1.1\bin\x64\R.exe</code></p>
  
  <p><code>Where Rcmd</code> prints output <code>C:\Program Files\R\R-3.1.1\bin\x64\Rcmd.exe</code></p>
  
  <p><code>Where Rgui</code> prints output <code>C:\Program Files\R\R-3.1.1\bin\x64\Rgui.exe</code></p>
  
  <p>Return the same paths pointing to their respective exe files. </p>
  
  <p>This is clearly a problem with my global environment paths, but I cant see why it would produce this error </p>
  
  <p>The paths look like (the R path on the last line) : </p>
  
  <pre><code>     c:\Rtools\bin      
       c:\Rtools\gcc-4.6.3\bin      
       C:\RBuildTools\3.1\bin 
       C:\RBuildTools\3.1\gcc-4.6.3\bin   
       c:\Rtools\bin
       c:\Rtools\gcc-4.6.3\bin  
       C:\Python27\   
       C:\Python34\     
       C:\Python34\Scripts      
       C:\Program Files (x86)\Intel\iCLS Client\   
       C:\Program Files\Intel\iCLS Client\ 
       C:\windows\system32  
       C:\windows 
       C:\windows\System32\Wbem      
       C:\windows\System32\WindowsPowerShell\v1.0\    
       C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86 
       C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64  
       C:\Program Files\Intel\Intel(R) Management Engine Components\DAL    
       C:\Program Files\Intel\Intel(R) Management Engine Components\IPT    
       C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL   
       C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT     
       C:\Program Files (x86)\QuickTime\QTSystem\  
       c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\    
       c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\      
       c:\Program Files\Microsoft SQL Server\100\Tools\Binn\   
       c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\  
       C:\strawberry\c\bin  
       C:\strawberry\perl\site\bin   
       C:\strawberry\perl\bin    
       C:\Program Files\MiKTeX 2.9\miktex\bin\x64\    
       C:\Program Files\MiKTeX 2.9\miktex\bin\x64\
       C:\Program Files\R\R-3.1.1\bin\x64  
  </code></pre>
  
  <p>I can run Python and Perl from just typing either's name into the cmd window, and as R is pointed to in the same way I can't understand the above error.</p>
  
  <p>If anyone has any suggestions on how I can fix this error I would be very grateful.</p>
  
  <p>I've not asked a question of this nature on here before so any editing / pointers greatly appreciated too.</p>
  
  <p>The raw path:</p>
  
  <pre><code>PATH=C:\Program Files\R\R-3.1.1\bin\x64;C:\Program Files\R\R-3.1.1\bin\x64;c:\Rt
  ools\bin;c:\Rtools\gcc-4.6.3\bin;C:\RBuildTools\3.1\bin;C:\RBuildTools\3.1\gcc-4
  .6.3\bin;c:\Rtools\bin;c:\Rtools\gcc-4.6.3\bin;C:\Python27\;C:\Python34\;C:\Pyth
  on34\Scripts;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iC
  LS Client\;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\Sy
  stem32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x
  86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files\Intel\In
  tel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Manageme
  nt Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine
   Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Componen
  ts\IPT;C:\Program Files (x86)\QuickTime\QTSystem\;c:\Program Files (x86)\Microso
  ft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;c:\Program Files (x86)\Microso
  ft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Bi
  nn\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\strawberry\c\bi
  n;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;C:\Program Files\MiKTeX 2.9
  \miktex\bin\x64\;C:\Program Files\MiKTeX 2.9\miktex\bin\x64\;C:\Users\Tariq.Muma
  n\AppData\Local\Pandoc\
  </code></pre>