Using Windows Explorer to Start R with Specified Working Directory
Earl F Glynn
Stowers Institute for Medical Research
In Windows when you start R, you get the working directory specified with the properties associated with the R icon you clicked (Right click on the R icon and select properties):

If you're happy with a single working directory, you can edit the Start in property above to change the working directory when you start R. Also, a proxy server can be specified in the Target line above if desired, e.g.,
"C:\Program Files\R\R-2.4.1\bin\Rgui.exe" http_proxy=http://proxy1:8080 http_proxy_user=ask
Windows Explorer (not to be confused with Internet Explorer) is a tool for working with your folders and files. There are various ways to start Windows Explorer, but perhaps the easiest way is to right click on the Start button (normally at the lower left) and select Explore. Clicking My Computer gives a similar screen, but the Windows Explorer tool is a bit more flexible.
Folders can be quickly located using Windows Explorer by navigating the folder tree. For example: the folder U:\efg\LombScargle can be found quickly using Windows Explorer:

Once a folder is found with Windows Explorer, starting R using that folder as the working directory would be a nice feature. This can be done if an appropriate registry key is added to Windows.
Windows Registery Keys
Download any of the following .reg files (make sure they have a .reg extension). I'm not sure why the direct links do not seem to work with Internet Explorer or Firefox (at least for me). You can view/edit any of these .reg files using NotePad (see Technical Details below).
Click on the downloaded .reg file to add/delete Windows registry keys for specific versions of R:
Current Version
Assumes R is installed in C:\Program Files\R\R-2.4.1:
Add R 2.4.1 Key Delete R 2.4.1 KeyOlder Versions
Assumes R is installed in C:\Program Files\R\R-2.4.0:
Add R 2.4.0 Key Delete R 2.4.0 KeyAssumes R is installed in C:\Program Files\R\R-2.3.1:
Add R 2.3.1 Key Delete R 2.3.1 Key
Start R in Windows Explorer with a Right Click on Working Directory
With the key added to the Windows registry, one can right click and select the dirctory, AND then click on R to use that directory.
For example, right click on a directory and select the R 2.4.1 option:
Verify the right version of R was launched:

Verify we have the working directory chosen with the Windows Explorer:

Any version of R can be started this way (assuming it's already installed) if multiple keys are added to the registry:
Technical Details
The .reg files, which can be downloaded from above, can be edited using NotePad:


With each new version of R, you can rename and edit an existing .reg file to work with the new version.
A proxy server can also be included in the Add.reg file, e.g.:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Folder\shell\R 2.4.1]
[HKEY_CLASSES_ROOT\Folder\shell\R 2.4.1\command]
@="C:\\Program Files\\R\\R-2.4.1\\bin\\Rgui.exe http_proxy=http://proxy1:8080 http_proxy_user=ask"
Of course, all of the above registry keys can also be added/modified/deleted using the regedit program. Be cautious modifying registry keys.
Updated
4 Jan 2007