# [R] R CMD not recognized at command-line

Gabor Grothendieck ggrothendieck at gmail.com
Tue Jan 10 21:26:05 CET 2006

```In

http://cran.r-project.org/contrib/extra/batchfiles/

there are Windows XP batch files that you can use that will
automatically locate R using the registry and run it so that you
don't have to change your path.  Just place them anywhere

I use them for building packages and also have a shortcut on my
desktop to one of them with a shortcut key defined so that after
installing a new version of R it automatically uses the new
version without any action on my part to reset the shortcut and
shortcut key.

On 1/10/06, Elizabeth Purdom <epurdom at stanford.edu> wrote:
> Hi,
> I am trying to run a batch command on Windows XP and R CMD is not
> recognized. I get the error,
>
> "'R' is not recognized as an internal or external command, operable program
> or batch file."
>
> I have "C:\Program Files\R\rw2010\bin" in my \$PATH variable and Rcmd.exe
> has been installed in that folder. I have restarted the computer to make
> sure any changes in the \$PATH variable registered. I have tried directly
> calling Rcmd.exe or R.exe. None of this had any effect and I can't think
> what I'm forgetting. In Cygwin,  I can get around this by explicitly giving
> the path at the prompt line, for example,
>
>  > ~/Program\ Files/R/rw2010/bin/R CMD --help
>
> This work-around does not seem work from the usual DOS Command Prompt, but
> I rarely use DOS commands so I may be missing something in syntax.
> Similarly, if I want to run several successive input files with a .bat
> file, this work-around won't work as a line in the .bat file.
>
> I have two questions:
> 1) how can I make the computer recognize R so I can just type R CMD at the
> prompt
> 2) what is a work-around like I did in cygwin that will work in a .bat file
> or the standard command-line prompt so that you don't have to change the
> path variable? (often students do not have permission to add the R folder
> to the path variable of a networked computer, so I'd like to know an
> alternative if someone asks me)
>
> Thanks,
> Elizabeth Purdom
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help