Re: [Rd] Version names

From: Gabor Grothendieck <>
Date: Mon 29 Nov 2004 - 13:11:31 EST

Gabor Grothendieck <ggrothendieck <at>> writes:

> Simon Urbanek <simon.urbanek <at>> writes:

> : If all you want to do is to determine the current (most recently
> : installed) R version, then all it takes is two lines of C code [just
> : read one registry entry] - and it's at least as portable across Windows
> : systems as a batch script, but far more flexible. (There may even be a
> : way to get that info w/o coding at all - I'm not sure whether regedit
> : has any batch mode or something ...).
> I don't think regedit has a batch mode. e.g. regedit /? does not give help.

I looked into a bit more and some of this information is actually in the FAQ:

	2.15 Does R use the Registry?
	Not itself. 

	The installers set some entries to allow uninstallation. In
	addition (by default, but this can be de-selected) they set
	a Registry key LOCAL_MACHINE\Software\R-core\R giving the
	version and install path. Again, this is not used by R
	itself, but it will be used by the DCOM interface
	( Finally, a
	file association for extension .RData is set in the

	You can add the Registry entries by running RSetReg.exe in
	the bin folder, and remove them by running this with
	argument /U. Note that the settings are all per machine and
	not per user, and that this neither sets up nor removes the
	file associations. 

Also it seems that one uses reg.exe rather than regedit.exe from batch files so putting all this together we get the following Windows XP batch statement to get the current path to the rw.... folder. It puts the path into the Rrw variable:

for /f "tokens=2*" %%a in (

        'reg query hklm\software\r-core\r /v InstallPath') do set Rrw=%%b

The bad news is that this is not 100% guaranteed to work since, as mentioned above, the user can deselect modification of the registry during installation but its certainly more than sufficient for my purposes and probably most other purposes too.

Thanks for pointing the way. mailing list Received on Mon Nov 29 13:17:33 2004

This archive was generated by hypermail 2.1.8 : Fri 18 Mar 2005 - 09:01:50 EST