[R] Set working directory by dragging text file onto R shortcut? [WinXP, unfortunately]

Gabor Grothendieck ggrothendieck at gmail.com
Tue May 12 03:51:11 CEST 2009


One additional way to use this is to place RGuiStart.bat on your
desktop and then you can drag a folder to it.

On Mon, May 11, 2009 at 7:14 PM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> There are a several possibilities using batchfiles whose
> home page is at:
>
> http://batchfiles.googlecode.com
>
> When on that home page note that there are different versions of
> these utilities for XP and Vista.
>
> There are two utilities that could be used.  Description is
> for Vista so for XP you may have to vary it slightly.
>
> 1. RguiStart.bat is a batch file that starts R interpreting
> its first argument as the folder in which to start R (or if its
> an .Rdata file then it interprets it as the .Rdata file to start
> R with).  The main reason for its existence is so that you can
> place it in your SendTo folder.  On Vista do this:
>
>  copy RguiStart.bat %APPDATA%\Microsoft\Windows\SendTo
>
> Then, on Vista, when you are in Windows Explorer you can right click
> on any folder in your user area and choose SendTo.  From the SendTo
> menu choose RGuiStart.bat to start up R in that folder.  If you
> right click on an .Rdata file rather than a folder then R will
> start up with that file loaded (although in that case its probably
> easier to just double click the .Rdata file provided you have
> file type associations set up -- if you don't then the RguiStart.bat
> will provide an alternative).
>
> 2. Rgui.bat is a batch file that starts up R.  Just shift right click
> a folder in Windows
> Explorer and choose Open Command Window Here and then when the command
> window opens enter Rgui assuming you have placed Rgui.bat somewhere on
> your path.
>
> Note that Rgui.bat and RguiStart.bat are actually the same file just renamed.
> When it runs it uses the name by which it was called to determine what to do.
> The files have no dependencies and find R by looking in the registry so when
> you install a new version of R they continue to work without any change
> (because installing a new version of R updates the registry).
>
> On Mon, May 11, 2009 at 6:30 PM, Mark Na <mtb954 at gmail.com> wrote:
>> Hi R-helpers,
>>
>> I must use WinXP at work, and I'm missing a particular feature that's
>> available in R on my Mac at home...
>>
>> In WinXP I would like to launch R by dragging and releasing a text
>> file on top of the R shortcut on my desktop. Then, I would like the
>> working directory to be automatically set to the location of that text
>> file.
>>
>> That's what works in MacOS, but I can't figure out if it's possible in WinXP.
>>
>> Any ideas? I'd appreciate it...
>>
>> Thanks, Mark Na
>>
>> PS What I do now is make a new R shortcut for each project, store that
>> shortcut in the directory containing that project's datafiles and R
>> programs (which are in text files), and set the "Start in" value to
>> that directory...but this has to be set up uniquely for each
>> project...
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>




More information about the R-help mailing list