R CMD on Windows 7 Error - "R" is not recognized as an internal or external command, R CMD on Windows 7 Error - "R" is not recognized as an internal or external command, r r

R CMD on Windows 7 Error - "R" is not recognized as an internal or external command,


  • Have you closed the command prompt and opened a new one after adjusting the PATH?
  • Enter the command PATH on the command line and ensure that you are properly updating your path
  • Try navigating to the directory where R.exe is saved and running it locally -- cd C:\Program...\bin\x64, R.exe.
  • Ensure that you're running on Windows' Command Prompt and not Cygwin's terminal
  • If you actually have a space after the semi-colon in your PATH, you'll need to remove that: /bin;C:/Program.... Try combining that with Joshua's solution.


I attach my whole solution here:

  1. Install Rtools which is compatible with my R version
  2. Add PATH: C:\Program Files\R\R-2.15.1\bin\x64;C:\Rtools\bin;C:\Rtools\gcc-4.6.3\bin
  3. In cmd, enter: R CMD INSTALL packagename

Click "enter", done.


I had a lot of trouble getting this to work, and finally found the golden nugget on r-project (R doesn't like spaces in paths) so here's how I finally did all this:

  • I installed R to "c:\programs" instead of "c:\program files...". My final path to RSCRIPT.exe is "C:\Programs\R\R-2.15.2\bin\Rscript.exe"
    • I added that directory to my PATH, but that doesn't seem to help
    • RStudio is also installed under c:\Programs (e.g. c:\Programs\RStudio), but RTools is installed under the "c:\" root directory (e.g. c:\RTools).
  • I downloaded all the packages to "c:\downloads\r"
  • I opened a command prompt in "c:\downloads\r" and ran the R CMD install from this downloads directory, specifying the path to R
    • e.g. "C:\Programs\R\R-2.15.2\bin\x64\R CMD INSTALL colorspace_1.2-0.zip"