[GRASS-SVN] r59585 - grass/trunk/mswindows/external/rbatch
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Apr 5 13:47:57 PDT 2014
Author: hellik
Date: 2014-04-05 13:47:57 -0700 (Sat, 05 Apr 2014)
New Revision: 59585
Added:
grass/trunk/mswindows/external/rbatch/#Rscript2.bat
grass/trunk/mswindows/external/rbatch/ANNOUNCE
grass/trunk/mswindows/external/rbatch/COPYING
grass/trunk/mswindows/external/rbatch/LICENSE
grass/trunk/mswindows/external/rbatch/NEWS
grass/trunk/mswindows/external/rbatch/R.bat
grass/trunk/mswindows/external/rbatch/README
grass/trunk/mswindows/external/rbatch/README.html
grass/trunk/mswindows/external/rbatch/RESOURCES
grass/trunk/mswindows/external/rbatch/Rpathset.bat
grass/trunk/mswindows/external/rbatch/THANKS
grass/trunk/mswindows/external/rbatch/batchfiles.md
grass/trunk/mswindows/external/rbatch/batchfiles.tex
grass/trunk/mswindows/external/rbatch/clip2r.js
grass/trunk/mswindows/external/rbatch/copydir.bat
grass/trunk/mswindows/external/rbatch/el.js
grass/trunk/mswindows/external/rbatch/find-miktex.hta
grass/trunk/mswindows/external/rbatch/make-batchfiles-pdf.bat
grass/trunk/mswindows/external/rbatch/movedir.bat
Log:
update Windows batchfiles for use with R: part 3 - check in new files
Added: grass/trunk/mswindows/external/rbatch/#Rscript2.bat
===================================================================
--- grass/trunk/mswindows/external/rbatch/#Rscript2.bat (rev 0)
+++ grass/trunk/mswindows/external/rbatch/#Rscript2.bat 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,33 @@
+
+ at Echo OFF
+setlocal
+::
+:: License: GPL 2.0
+:: (c) 2013 GKX Associates Inc.
+::
+:: INSTALLATION INSTRUCTIONS:
+:: Modify the definitions of R_HOME and R_ARCH as needed
+:: (To get the value of R_HOME go into R and issue this command:
+:: normalizePath(R.home())
+:: and use its output as the value here. If you upgrade R to another
+:: version R_HOME will need to be changed. For most users R_ARCH can
+:: be left as set but if you have a 32 bit system then comment out the
+:: line setting R_ARCH and uncomment the prior line.)
+::
+:: RUN INSTRUCTIONS:
+:: Create an R script whose first line is:
+:: #Rscript2.bat %0 %*
+:: and give it a .bat extesion. If it is called test.bat then call it
+:: like this (adding arguments if any):
+:: test.bat
+
+set R_HOME=C:\Program Files\R\R-3.0.2
+
+:: 32 or 64 bit version of R.
+:: (If you wish to use both versions of R make two versions of this file.)
+:: set R_ARCH=i386
+
+set R_ARCH=x64
+
+set R_PATH=%R_HOME%\bin\%R_ARCH%
+"%R_PATH%\Rscript.exe" %*
Added: grass/trunk/mswindows/external/rbatch/ANNOUNCE
===================================================================
--- grass/trunk/mswindows/external/rbatch/ANNOUNCE (rev 0)
+++ grass/trunk/mswindows/external/rbatch/ANNOUNCE 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,83 @@
+A new version of the Windows batchfiles is available.
+
+CHANGES
+
+The key change is the new R.bat utility. R.bat has a new interface and
+extended functionality covering many of the other prior utilities. (These
+older utilities are no longer needed and have been removed.)
+
+Unlike R.bat which requires no configuration the new Rpathset.bat utility is
+configured by manually changing the Windows batch SET statements in it. The
+main advantage is just that it is very simple internally which may be
+advantageous in some situations involving customization.
+
+A new pdf document accompanies the utilties providing more detail.
+
+OVERVIEW
+
+These are self contained independent no-install Windows batch, javascript and
+.hta files. Just place any that you wish to use on your Windows PATH.
+
+R.bat
+
+R.bat allows one to run R without setting any environment variables, registry
+keys or any modification of the Windows path. Just download this utility,
+place it in your Windows path and then to launch Rgui.exe from the Windows cmd
+line do this:
+
+ R gui
+
+R.bat locates R, MiKTeX and Rtools using the registry or heuristics and then
+runs the subcommand indicated by the first argument.
+
+In addition to the gui subcommand, the following subcommands are available: cd,
+cmd, dir, gui, help, ls, path, R, script, show, SetReg, tools, touch.
+
+Some examples are:
+
+R -- run R.exe
+R gui -- run Rgui.exe
+R CMD build mypkg -- run Rcmd.exe build mypkg
+R script myScript.R -- run Rscript.exe myScript.R
+
+R dir -- list directories in R_ROOT, typically those in C:\Program Files\R
+R ls -- same
+R help -- help info
+R show -- show R_ variable values used (R_ROOT, R_HOME, R_VER, R_ARCH, etc.)
+
+R path -- temporarily add R, MiKTeX and Rtools to the Windows path
+R tools -- similar but only add MiKTeX and Rtools to the Windows path
+
+Except for R touch (which updates the date on your R_HOME directory) and
+R SetReg (which calls RSetReg.exe to update the registry with your R version),
+R.bat makes no permanent changes to your system.
+
+Rpathset.bat
+
+Rpathset.bat temporarily sets the Windows path to R, Rtools and MiKTeX
+based on SET statements that the user can configure manually. It is an
+alternative to R.bat that lacks R.bat's "no configuration" nature but may be
+preferred in some situations due to its internal simplicity.
+
+Also Rpathset.bat is more likely to work on systems that have not been
+tested given its simplicity. (The utilities were tested on 32 bit Windows
+Vista and 64 bit Windows 8 systems.)
+
+Other
+
+Other commands which continue to be available are copydir.bat, movedir.bat,
+el.js, clip2r.js and find-miktex.hta . These copy and move R libraries,
+run a command in elevated mode (i.e. as Administrator), copy the clipboard to
+a running R instance and find MiKTeX.
+
+More Info
+
+The newly created sqldf discussion list will now be used for discussion of
+the batch files as well.
+
+Home Page: http://batchfiles.googlecode.com
+Discuss: http://groups.google.com/group/sqldf ** NEW **
+
+Download: http://cran.r-project.org/contrib/extra/batchfiles
+SVN: https://code.google.com/p/batchfiles/source
+
Added: grass/trunk/mswindows/external/rbatch/COPYING
===================================================================
--- grass/trunk/mswindows/external/rbatch/COPYING (rev 0)
+++ grass/trunk/mswindows/external/rbatch/COPYING 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
Added: grass/trunk/mswindows/external/rbatch/LICENSE
===================================================================
--- grass/trunk/mswindows/external/rbatch/LICENSE (rev 0)
+++ grass/trunk/mswindows/external/rbatch/LICENSE 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,5 @@
+This code is: Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 GKX Associates Inc.
+
+All code is subject to the GNU General Public License, Version 2. See
+the file COPYING for the exact conditions under which you may
+redistribute it.
Added: grass/trunk/mswindows/external/rbatch/NEWS
===================================================================
--- grass/trunk/mswindows/external/rbatch/NEWS (rev 0)
+++ grass/trunk/mswindows/external/rbatch/NEWS 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,320 @@
+Changes in version 0.7-2
+
+ o new command #Rscript2.bat is a simpler version of #Rscript.bat
+
+ o bug fix in clip2r.js
+
+Changes in version 0.7-1
+
+ o remove duplicates from R_TOOLS_PATH
+
+Changes in version 0.7-0
+
+ o R.bat reworked. It now has a with different interface and many prior
+ batch files have been incorporated into it and removed
+
+ o new Rpathset.bat
+
+ o new documentation: batchfiles.md (and batchfiles.pdf produced from it
+ using make-batchfiles.pdf.bat
+
+Change in version 0.6-7
+
+ o Rtools paths changed
+
+Changes in version 0.6-6
+
+ o bug fixes
+
+Changes in version 0.6-5
+
+ o if MYSQL_HOME has not already been set then it set it to the last file
+ among these, if any:
+
+ %ProgramFiles%\MySQL\*
+
+ This allows one to install and run RMySQL without setting any environment
+ variables. (Note that MySQL should be installed from the mysql site.
+ xampp and wamp do not include the header files needed by RMySQL.)
+
+Changes in version 0.6-4
+
+ o fixed bugs
+
+Changes in version 0.6-3
+
+ o fixed bugs
+
+Changes in version 0.6-1
+
+ o fixed bugs
+
+ o R_ARCH and --arch can consistently be any of 32, i386, 64, x64, /i386 or /64
+ (vs R itself which otherwise uses different values for R_ARCH and --arch)
+
+Changes in version 0.6
+
+ o enhancements to handle architecture specific directory structure in R 2.12.0
+ Supports R_ARCH environment variable and --arch= first argument. Valid
+ values are 32, 64, i386, x64. Default is i386.
+
+Changes in version 0.5-1
+
+ o new experimental command clip2r.js
+
+ o bug fixes
+
+Changes in version 0.5-0
+
+ o new command show-svn-info.hta when run from a Tortoise SVN checkout
+ folder shows some info about it. Requires Tortoise SVN version 1.5
+ or higher.
+
+ o new command find-miktex.hta can be run without arguments from the
+ Windows command line or double clicked from Windows Explorer
+ to show path to the MiKTeX bin directory.
+
+ o Rversions.hta now also changes the .RData association and has
+ been verified to work on both XP and Vista.
+
+ o new RExcelversion.hta (also distributed with RExcel) that is like
+ Rversions.hta but also sets the version for Rexcel at the same time
+ and has been verified to work on both XP and Vista.
+
+ o jgr.bat now passes the Windows library and R home to jgr.exe automatically
+
+ o added defensive code to allow code to work even in the presence of
+ certain bad PATH variables
+
+ o testing on XP32, XPx64, Vista32, Win7x64 (thanks to Nicholas Hirschey)
+
+Changes in version 0.4-3
+
+ o Sweave.bat and Stangle.bat were not automatically finding MiKTeX.
+ Fixed.
+
+Changes in version 0.4-2
+
+ o can optionally work off initialization files in place of registry.
+ Place rbatchfilesrc.bat in current directory or %userprofile% (so
+ different directories can work off different versions of R, say)
+ or same directory as the other batchfiles and it will run it first.
+ Typically rbatchfiles.bat would constain these two lines or similar:
+ set R_HOME=C:\Program Files\R\R-2.7.0
+ set R_TOOLS=C:\Rtools
+
+ o added Stangle.bat
+
+Changes in version 0.4-1
+
+ o it is no longer necessary to set any paths to build R packages
+ provided Rtools 2.7 or later is used. Rcmd.bat and the other
+ scripts automatically find Rtools from the registry (including perl)
+ and if MikTeX is at %ProgramFiles%\MiKTeX* or %SystemDrive%:\MiKTex
+ then it will find MiKTeX too. New optional environment variables
+ R_TOOLS and R_MIKTEX are available to force specified paths to be used.
+
+ o new Rtools.bat command that sets the path for the current cmd instance
+ to the one that R*.bat files use internally. That is, rtools/bin,
+ rtools/perl/bin, rtools/MinGW/bin and MiKTeX .../miktex/bin are added
+ to the path. This is not needed to run or install R programs but only
+ if you want to access the rtools for other purposes.
+
+ o new el.js command which runs the command given as its argument elevated.
+ e.g. el cmd
+
+Changes in version 0.4-0
+
+ o as of 0.4-0 batchfiles is being developed and tested on Vista.
+ It may still work on XP but if any of the commands do not then use
+ version 0.3-2 instead since that was exclusively tested on XP.
+
+ o added RguiStart.bat which is like Rgui.bat but takes a single argument
+ which is a directory and starts up there
+
+ o the dependency of sweave.bat on Rterm.bat was eliminated so all
+ batch and javascript programs in this collection are now independent
+ of each other and have no dependencies aside form R. (The perl
+ program, toggleDoc.pl, is does depend on perl and toggleDoc.js.)
+
+ o added info on how to use RguiStart.bat and sweave.bat with SendTo
+ folder
+
+ o misc improvements to README file
+
+ o improved help message given by sweave.bat when issued with no arguments
+
+ o removed only tested on XP messages since they work on Vista
+
+ o changed algorithm in Rversions.bat. Now it checks current directory,
+ R_HOME and all keys in R's portion of the registry plus all sibling
+ folders of those mentioned. Also it runs RSetReg.exe elevated
+ on Vista. New version has not been tested on XP; however, older
+ versions are still available and were tested on XP.
+
+ o updated copydir.bat portion of README to discuss additional alternatives
+
+ o removed find-miktex.bat, Rfind.bat and makepkg.bat (they are still
+ available in batchfiles version 0.3-2)
+
+ o added toggleDoc.pl/toggleDoc.js which adds a toggle box to each 00Index.html
+ which when checked collapses similar HTML help lines into one. Contributed
+ by Dieter Menne.
+
+Changes in version 0.3-2
+
+ o sweave.bat now uses Rterm.bat rather than Rcmd.bat which makes it usable
+ with a basic R installation (i.e. sh.exe not needed). Previously it
+ required Rcmd.bat but now it requires Rterm.bat instead.
+
+ o added Rterm.bat (just a copy of Rcmd.bat)
+
+Changes in Version 0.3-1
+
+ o new find-miktex.bat which lists the mixktex folders from the registry
+
+ o new Rscript.bat which allows one to use the Rscript facility in
+ R 2.5.0 and later without changing pathnames. Just place Rscript.bat
+ in any existing path and it will automatically find the
+ current version of R from the registry and run the Rscript.exe that
+ is there.
+
+ o runR.bat. If you have an R script such as myfile.R then you can create
+ a batch script for it by copying runR.bat to myfile.bat. Then when you
+ issue the command myfile or myfile.bat it will run the R script in
+ myfile.R . Just place myfile.bat and myfile.R anywhere in your path.
+ This uses Rscript.bat .
+
+ o #Rscript. If you have an Rscript called myfile.R, say, then if you
+ copy the script to myfile.bat and place
+ #Rscript %0 %*
+ as the first line with the remainder being the R commands then issuing
+ the command myfile or myfile.bat will run the R script. The advantage
+ over the runR.bat method is that there is only one file, myfile.bat.
+ You don't need myfile.R anymore. The disadvantage is that it will
+ echo the #Rscript line to stdout. This will be fixed if and when
+ Rscript ever gets the perl/python/ruby -x flag. (The runR approach will
+ not echo additional lines but does require two files.)
+
+ o new Rtidy.bat is a sample Rscript that uses the #Rscript facility
+ based on George Georgalis' UNIX code
+
+ o withgs.bat now checks for latest ghostscript version. (Previously
+ version was hard coded and it only worked for that version.)
+
+Changes in Version 0.3-0
+
+ o sweave now generates a second .pdf ending which is a copy of the first
+ but has a unique name and displays that. This works around a problem
+ with acrobat that it will not display two files with the same name
+ at the same time.
+
+ o new --tex, --pdf, --nobck.pdf switches are available on sweave. Also
+ expanded help when entering sweave without args.
+
+Changes in Version 0.2-9
+
+ o updated README and other documentation files and inline documentation
+
+ o added sweave.bat
+
+ o new google code home page and svn repository
+ http://code.google.com/p/batchfiles/
+
+Changes in Version 0.2-8
+
+ o bug fix in copydir.bat and movedir.bat
+
+Changes in Version 0.2-7
+
+ o removed extra popup from Rversions.hta
+
+ o Rfind.bat now looks in registry for MiKTeX, replacing
+ previous heuristic. [Thanks for help from Duncan
+ Murdoch]. Also RToolsDir typo fixed in Rfind.bat.
+
+Changes in Version 0.2-6
+
+ o batch files no longer use short names internally since this
+ triggers a bug in Windows batch in the case of the new R
+ folder naming conventions.
+
+ o Rversions.hta - fix for path names with spaces
+
+ o Rrefresh.bat has been removed (after having been deprecated in
+ in previous versions of batchfiles).
+
+ o tested movedir.bat by using it to upgrade R-2.2.0pat to R-2.2.1.
+ See instructions in README.
+
+Changes in Version 0.2-5
+
+ o added movedir.bat which moves libraries from one version of
+ R to another. This is like copydir.bat but is much faster and
+ can be used when the older version of R is no longer needed
+ (unlike copydir.bat which preserves the older version). See
+ README for usage.
+
+Changes in Version 0.2-3
+
+ o added copydir.bat which can copy libraries from one version of
+ R to another. (This is a temporary solution until R provides
+ facilities for upgrading the libraries, expected in R 2.3.0 .)
+ See README for usage.
+
+ o eliminated all code associated with reading and manipulation of
+ R_ENVIRON, R_PROFILE and R_LIBS simplifying the batch files. Use
+ copydir.bat instead.
+
+ o Rversions.hta is a javascript GUI version of Rversions.bat
+
+Changes in Version 0.2-2
+
+ o added jgr.bat which starts up the JGR GUI.
+
+ o added Rversions.bat which can list the directories of all R versions
+ available and can set one to become the current R version.
+
+ o all batch scripts which used the environment variable name Rrw now
+ use the environment variable name R_HOME instead.
+
+ o Rcmd.bat, Rgui.bat, R.bat, jgr.bat files will now read R_ENVIRON,
+ if present, and set the R_LIBS definition in it, if present (unless
+ R_LIBS is already defined as an environment variable). All R_ENVIRON
+ file syntax accepted by R is supported including comments (#),
+ var=value, var=${foo-bar} and recursions, var=${A-${B-C}}.
+
+ o makepkg.bat internals were simplified due to previous point.
+
+ o updated WISHLIST.
+
+ o updated THANKS.
+
+ o updated README. More introductory information. Also instructions
+ for Rgui shortcut will disable screen flash on startup. Corrections.
+
+Changes in Version 0.2-1
+
+ o improvements to README
+
+Changes in Version 0.2-0
+
+ o can now support configurations without *.site files (as well as
+ configurations with *.site files) thereby reducing the minimum
+ configuration even further.
+
+ o Rcmd.bat, Rgui.bat and R.bat now temporarily set R_ENVIRON,
+ R_PROFILE and R_LIBS as needed so that it is no longer necessary to
+ copy the *.site files into the etc directory eliminating all
+ reconfiguration when upgrading to a new version of R (except for
+ refreshing MiKTeX).
+
+ o new command miktex-refresh.bat is used to refresh MiKTeX after a
+ new version of R is installed. Previously this was done in
+ Rrefresh.bat which is now deprecated. Rrefresh.bat is no longer
+ needed (unless you want each R version to have its own *.site files).
+
+ o new NEWS, WISHLIST and RESOURCES files.
+
+ o README provides additional details.
+
Added: grass/trunk/mswindows/external/rbatch/R.bat
===================================================================
--- grass/trunk/mswindows/external/rbatch/R.bat (rev 0)
+++ grass/trunk/mswindows/external/rbatch/R.bat 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,587 @@
+ at Echo OFF
+
+:: Software and documentation is (c) 2013 GKX Associates Inc. and
+:: licensed under [GPL 2.0](http://www.gnu.org/licenses/gpl-2.0.html).
+
+:: Help is at bottom of script or just run script with single argument: help
+
+:: can optionally uncomment and change these to force certain values. This
+:: is normally unnecessary. Rather one can usually rely on the heuristics to
+:: set them.
+:: set R_CMD=R
+:: set R_HOME=%ProgramFiles%\R\R-2.14.0
+:: set R_ARCH=64
+:: set R_MIKTEX_PATH=%ProgramFiles%\MiKTeX 2.9\miktex\bin
+:: set R_TOOLS=C:\Rtools
+:: set MYSQL_HOME=%ProgramFiles%\MySQL\MysQL Server 5.1
+
+:: 1 means read registry and 0 means ignore registry
+if not defined R_REGISTRY set R_REGISTRY=1
+set CYGWIN=nodosfilewarning
+
+SetLocal EnableExtensions EnableDelayedExpansion
+
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: R_CMD
+:: 1. if 1st arg is CMD then set R_CMD to R
+:: 2. else if 1st arg is Rshow, Rpath, Rgui, Rcmd, R or Rscript set R_CMD to it
+:: and remove it from args
+:: 3. else use R_CMD if set
+:: 4. else use %0
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+set args=%*
+set cmd=
+if /i "%~1"=="cd" set cmd=Rcd
+if /i "%~1"=="CMD" set cmd=Rcmd
+if /i "%~1"=="dir" set cmd=Rdir
+if /i "%~1"=="ls" set cmd=Rdir
+if /i "%~1"=="gui" set cmd=Rgui
+if /i "%~1"=="help" goto:Rhelp
+if /i "%~1"=="path" set cmd=Rpath
+if /i "%~1"=="R" set cmd=R
+if /i "%~1"=="script" set cmd=Rscript
+if /i "%~1"=="show" set cmd=RShow
+if /i "%~1"=="SetReg" set cmd=RSetReg
+if /i "%~1"=="tools" set cmd=Rtools
+if /i "%~1"=="touch" set cmd=Rtouch
+
+if "%cmd%"=="" goto:R_CMD_cont
+if "%2"=="" (set args=) && goto:R_CMD_cont
+set args=xxx%*
+call set args=%%args:xxx%1=%%
+:R_CMD_cont
+if defined cmd set R_CMD=%cmd%
+if not defined R_CMD set R_CMD=%0
+set R_CMD=%R_CMD:.bat=%
+if /i "%R_CMD%"=="#Rscript" set R_CMD=Rscript
+rem echo R_CMD:%R_CMD% args=[%args%]
+
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: 1. If .\Rgui.exe exist use implied R_PATH and skip remaining points.
+:: 2. If .\{x64,i386}\Rgui.exe or .\bin\{x64,i386}\Rgui.exe exists use implied R_HOME.
+:: 3. if R_HOME defined then derive any of R_ROOT and R_VER that
+:: are not already defined.
+:: 4. if R_PATH defined then derive any of R_ROOT, R_HOME, R_VER and R_ARCH that
+:: are not already defined.
+:: 4a. If R_REGISTRY=1 and R found in registry derive any of R_HOME, R_ROOT and
+:: R_VER that are not already defined.
+:: 5. If R_ROOT not defined try %ProgramFiles%\R\*, %ProgramFiles(x86)%\R\*
+:: and then %SystemRoot%\R else error
+:: 6. If R_VER not defined use last directory in cd %R_ROOT% & dir /od
+:: 7. if R_ARCH not defined try %R_ROOT%\%R_VER%\bin\x64\Rgui.exe and then
+:: %R_ROOT%\%R_VER%\bin\i386\Rgui.exe
+:: 8. If R_ROOT, R_VER and R_ARCH defined skip remaining points.
+:: 9. If Rgui.exe found on PATH use implied R_PATH.
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+:: 1
+if exist Rgui.exe (
+ pushd ..\..
+ set R_HOME=!CD!
+ popd
+ goto:R_exe_end
+)
+
+:: 2
+if exist x64\Rgui.exe (
+ pushd ..
+ set R_PATH=!CD!\bin\x64
+ popd
+ goto:R_exe_end
+)
+if exist i386\Rgui.exe (
+ pushd ..
+ set R_PATH=!CD!\bin\i386
+ popd
+ goto:R_exe_end
+)
+if exist bin\x64\Rgui.exe set R_PATH=%CD%\bin\x64 & goto:R_exe_end
+if exist bin\i386\Rgui.exe set R_PATH=%CD%\bin\i386
+:R_exe_end
+
+:: 3
+if defined R_HOME (
+ pushd
+ cd %R_HOME%
+ if not defined R_VER for /f "delims=" %%a in ("!CD!") do set R_VER=%%~na
+ cd ..
+ if not defined R_ROOT set R_ROOT=!CD!
+ popd
+)
+
+:: 4
+if defined R_PATH (
+ pushd
+ cd %R_PATH%
+ if not defined R_ARCH for /f "delims=" %%a in ("!CD!") do set R_ARCH=%%~na
+ cd ..\..
+ if not defined R_HOME set R_HOME=!CD!
+ if not defined R_VER for /f "delims=" %%a in ("!CD!") do set R_VER=%%~na
+ cd ..
+ if not defined R_ROOT set R_ROOT=!CD!
+ popd
+)
+
+
+:: 4a
+
+if not defined R_HOME for /f "tokens=2*" %%a in (
+ 'reg query hklm\software\wow6432Node\r-core\r /v InstallPath 2^>NUL ^| findstr InstallPath'
+ ) do set R_HOME=%%~b
+
+if not defined R_HOME for /f "tokens=2*" %%a in (
+ 'reg query hklm\software\R-core\R /v InstallPath 2^>NUL ^| findstr InstallPath'
+ ) do set R_HOME=%%~b
+
+if defined R_HOME (
+ if not defined R_ROOT (
+ pushd
+ cd %R_HOME%
+ cd ..
+ set R_ROOT=!CD!
+ popd
+ )
+ if not defined R_VER (
+ for /f "delims=" %%a in ("%R_HOME%") do set R_VER=%%~nxa
+ )
+)
+
+
+:: 5
+if defined R_ROOT goto:R_ROOT_end
+if exist "%ProgramFiles%\R" set R_ROOT=%ProgramFiles%\R
+if defined R_ROOT goto:R_ROOT_end
+if exist %SystemDrive%\R set R_ROOT=%SystemDrive%\R
+:R_ROOT_end
+
+:: 6
+if defined R_VER goto:R_VER_end
+for /f "delims=" %%a in (
+ 'dir /b /od /ad "%R_ROOT%" 2^>NUL'
+) do set R_VER=%%a
+:R_VER_end
+
+:: do we need this?
+if defined R_ROOT if defined R_VER set R_HOME=%R_ROOT%\%R_VER%
+
+:: 7
+if defined R_ARCH goto:R_ARCH_cont
+set R_ARCH=i386
+if exist "%R_HOME%\bin\x64" set R_ARCH=x64
+if exist "%R_ROOT%\%R_VER%\bin\x64" set R_ARCH=x64
+:R_ARCH_cont
+if "%R_ARCH%"=="64" set R_ARCH=x64
+if "%R_ARCH%"=="32" set R_ARCH=i386
+if "%R_ARCH%"=="386" set R_ARCH=i386
+
+:: 8
+if not defined R_ROOT goto:where
+if not defined R_VER goto:where
+if not defined R_ARCH goto:where
+set R_PATH=%R_ROOT%\%R_VER%\bin\%R_ARCH%
+goto:path_end
+
+echo "R not found" & exit /b 1
+
+:: 9
+:where
+where Rgui.exe 1>NUL 2>NUL
+if not errorlevel 1 for /f "delims=" %%a in ('where Rgui.exe') do set R_PATH=%%~pa
+
+:path_end
+
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: R_TOOLS
+:: 1. use R_TOOLS if defined. If not
+:: 2. check if ls.exe, rsync.exe and gcc.exe are on PATH. If not
+:: 3. check if Rtools found in registry. If not
+:: 4. check if C:\Rtools exists. If not
+:: 5. R_TOOLS not found.
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+if defined R_TOOLS goto:RtoolsEnd
+
+where ls.exe 1> NUL 2> NUL
+if errorlevel 1 goto:RtoolsNotOnPATH
+
+where rsync.exe 1> NUL 2> NUL
+if errorlevel 1 goto:RtoolsNotOnPATH
+
+where gcc.exe 1> NUL 2> NUL
+if errorlevel 1 goto:RtoolsNotOnPATH
+
+for /f "delims=" %%a in ('where rsync.exe') do set R_TOOLS=%%~pa
+pushd %R_TOOLS%
+cd ..
+set R_TOOLS=%CD%
+popd
+goto:RtoolsEnd
+
+:RtoolsNotOnPATH
+
+if not defined R_TOOLS for /f "tokens=2*" %%a in (
+ 'reg query hklm\software\R-core\Rtools /v InstallPath 2^>NUL ^| findstr InstallPath'
+ ) do set R_TOOLS=%%~b
+if not defined R_TOOLS for /f "tokens=2*" %%a in (
+ 'reg query hklm\software\wow6432Node\Rtools /v InstallPath 2^>NUL ^| findstr InstallPath'
+ ) do set R_TOOLS=%%~b
+
+if exist "C:\Rtools" set R_TOOLS=C:\Rtools
+
+:RToolsEnd
+
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: R_TOOLS_PATH
+:: Extract path from: %R_TOOLS%\unins000.dat
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+if defined R_TOOLS call :extract_string {app} %R_TOOLS%\unins000.dat
+call set R_TOOLS_PATH=%%final:{app}=%R_TOOLS%%%
+call :trimPath:R_TOOLS_PATH
+
+if defined R_TOOLS for /f "tokens=3" %%a in (%R_TOOLS%\Version.txt) do set R_TOOLS_VERSION=%%a
+
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: R_MIKTEX
+:: If R_MIKTEX defined use that
+:: else if pdflatex.exe on PATH use that else
+:: check %ProgramFiles%\miktex* else
+:: check %ProgramFiles(x86)%\miktex* else
+:: check %SystemDrive%\miktex*
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+if defined R_MIKTEX_PATH goto:miktex_end
+
+:: if pdflatex.exe found in PATH use implied path
+where pdflatex.exe 1>NUL 2>NUL
+if errorlevel 1 goto:miktex_continue
+set MIKTEX_ALREADY_ON_PATH=1
+for /f "delims=" %%a in ('where pdflatex.exe') do set R_MIKTEX_PATH=%%~pa
+:: remove trailing \, if any
+IF "%R_MIKTEX_PATH:~-1%"=="\" SET R_MIKTEX_PATH=%R_MIKTEX_PATH:~0,-1%
+
+goto:miktex_end
+
+:miktex_continue
+if not defined R_MIKTEX_PATH for /f "delims=" %%a in (
+ 'dir /b /on "%ProgramFiles%"\miktex* 2^>NUL'
+) do set R_MIKTEX_PATH=%ProgramFiles%\%%a\miktex\bin
+
+if not defined R_MIKTEX_PATH for /f "delims=" %%a in (
+ 'dir /b /on "%ProgramFiles(x86)%"\miktex* 2^>NUL'
+) do set R_MIKTEX_PATH=%ProgramFiles%\%%a\miktex\bin
+
+if not defined R_MIKTEX_PATH for /f "delims=" %%a in (
+ 'dir /b /on %SystemDrive%:\miktex* 2^>NUL'
+) do set R_MIKTEX_PATH=%SystemDrive%:\%%a\mixtex\bin
+
+:miktex_end
+
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: MySQL
+:: If MYSQL_HOME defined use that else
+:: check %ProgramFiles%\MySQL\* else
+:: check %SystemDrive%:\MySQL\*
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+:: if not defined MYSQL_HOME for /f "delims=" %%a in (
+:: 'dir /b /on "%ProgramFiles%"\MySQL\* 2^>NUL'
+:: ) do set MYSQL_HOME=%ProgramFiles%\MySQL\%%a
+::
+:: if not defined MYSQL_HOME for /f "delims=" %%a in (
+:: 'dir /b /on %SystemDrive%:\MySQL* 2^>NUL'
+:: ) do set R_MIKTEX=%SystemDrive%:\MySQL\%%a
+
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: get name by which program was called - $0
+:: or use R_CMD environment variable if that was defined (mainly for testing)
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+if not defined R_CMD (set R_CMD=%0)
+for %%i in (%R_CMD%) do set R_CMD=%%~ni
+
+if /i "%R_CMD%"=="dir" goto:Rdir
+if /i "%R_CMD%"=="cd" goto:Rcd
+if /i "%R_CMD%"=="touch" goto:Rtouch
+if /i "%R_CMD%"=="Rversions" goto:RSetReg
+
+:: add MiKTeX to PATH if not already on it
+if not defined R_MIKTEX_PATH goto :miktex_add_path_end
+echo %PATH% | findstr /i miktex 1>NUL 2>NUL
+if errorlevel 1 path %R_MIKTEX_PATH%;%PATH%
+:miktex_add_path_end
+
+:: add Rtools paths to PATH if not already on it
+if not defined R_TOOLS_PATH goto :Rtools_add_path_end
+echo %PATH% | findstr /i Rtools 1>NUL 2>NUL
+if errorlevel 1 path %R_TOOLS_PATH%;%PATH%
+:Rtools_add_path_end
+
+if /i "%R_CMD%"=="Rpath" goto:Rpath
+if /i "%R_CMD%"=="Rtools" goto:Rtools
+if /i "%R_CMD%"=="Rcd" goto:Rcd
+if /i "%R_CMD%"=="Rdir" goto:Rdir
+if /i "%R_CMD%"=="Rshow" goto:Rshow
+if /i "%R_CMD%"=="Rtouch" goto:Rtouch
+if /i "%R_CMD%"=="RSetReg" goto:RSetReg
+
+
+if /i not "%R_CMD%"=="Rgui" goto:notRgui
+start "Rgui.exe" "%R_PATH%\Rgui.exe" %args%
+goto:eof
+
+:notRgui
+"%R_PATH%\%R_CMD%.exe" %args%
+
+goto:eof
+
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: output the set statements
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:Rshow
+
+if defined R_PATH (
+ set old=%CD%
+ cd %R_PATH%
+ for /f "delims=" %%a in ("!CD!") do set R_ARCH=%%~nxa
+ cd ..\..
+ set R_HOME=!CD!
+ for /f "delims=" %%a in ("!CD!") do set R_VER=%%~nxa
+ cd ..
+ set R_ROOT=!CD!
+ cd !old!
+)
+
+:: echo set R_PATH=%R_PATH%
+:: echo set R_HOME=%R_HOME%
+:: echo set R_ROOT=%R_ROOT%
+:; echo set R_VER=%R_VER%
+:: echo set R_ARCH=%R_ARCH%
+:: echo set R_TOOLS=%R_TOOLS%
+:: echo set R_TOOLS_PATH=%R_TOOLS_PATH%
+:: :: echo set MYSQL_HOME=%MYSQL_HOME%
+::echo set R_MIKTEX_PATH=%R_MIKTEX_PATH%
+set R
+goto:eof
+
+:Rcd
+endlocal & cd %R_ROOT%
+goto:eof
+
+:Rdir
+dir/od "%R_ROOT%"
+goto:eof
+
+:RSetReg
+cd %R_PATH%
+RSetReg %args%
+goto:eof
+
+:: if not XP then check if running with Admin privs. If not give msg and exit.
+:Rtouch
+ver | findstr XP >NUL
+if not errorlevel 1 goto:Rtouch_next
+if not exist "%ProgramFiles%\R" goto:Rtouch_next
+reg query "HKU\S-1-5-19" >NUL 2>&1 && ( goto Rtouch_next ) || (
+ echo Please run this as Administator.
+ goto :eof
+)
+:Rtouch_next
+
+if not defined R_HOME set R_HOME=%R_ROOT%\%R_VER%
+pushd %R_HOME%
+echo > dummy.txt
+del dummy.txt
+popd
+goto:eof
+
+
+
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: set path
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:Rpath
+endlocal & PATH %PATH%;%R_PATH%
+goto:eof
+
+:Rtools
+endlocal & PATH %PATH%
+goto:eof
+
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: list R versions
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:Rversions
+if defined args goto:Rversions_cont
+pushd %R_HOME%
+cd ..
+echo R packages found. Most recent (last listed) is default:
+for /f "delims=" %%a in ('dir/b /od') do echo %%~fa
+popd
+goto:eof
+:Rversions_cont
+set args=###%args%
+set args=%args:### =%
+set args=%args:###=%
+pushd %R_HOME%
+cd ..
+(for /f "delims=" %%a in ('dir /b /od') do echo %%~fa) | findstr /L /C:"%args%" 1>NUL 2>NUL
+if errorlevel 1 echo %args% not found & goto:eof
+echo Run the following command (may need an elevated cmd window):
+for /f "delims=" %%a in ('dir /b /on ^| findstr /L /C:"%args%"') do @echo echo ^> "%%~fa\dummy.txt" /Y
+popd
+goto:eof
+
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:: list registry entries
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+:Rregistry
+reg query hklm\software\R-core\R /v InstallPath 2>NUL | findstr InstallPath
+reg query hklm\software\wow6432Node\r-core\r /v InstallPath 2>NUL | findstr InstallPath
+
+goto:eof
+
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::
+:: Extract text from file:
+:: %1 = input string that starts text
+:: %2 = input file
+:: final = output variable holding text from and including %1 until
+:: binary data encountered
+::
+:: Needs: SetLocal EnableExtensions EnableDelayedExpansion
+::
+:: Example:
+:: call :extract_string {app} C:\Rtools\unins000.dat
+:: echo %final%
+:: where {app} is the string that starts extraction and
+:: C:\Rtoolsiunins000.dat is the file
+::
+:: Based on code by Frank Westlake, https://github.com/FrankWestlake
+::
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+ :extract_string
+
+ setlocal
+
+ Set "string=%1"
+ Set "file=%2"
+
+ For /F "delims=" %%a in (
+ 'findstr /C:"%string%" "%file%"^|MORE'
+ ) Do (
+ Set "$=%%~a"
+ If /I "!$:~0,5!" EQU "%string%" (
+ Set $=!$:;=" "!
+ For %%b in ("!$!") Do (
+ Set "#=%%~b"
+ If "!#:~0,5!" EQU "%string%" (
+ CALL :work "!#!"
+ )
+ )
+ )
+ )
+ endlocal & set final=%final%
+ Goto :EOF
+ :work
+ set final=%final%!#!;
+ Goto :EOF
+
+ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+ :trimPath:<variable to trim> [segment to add]
+ :: Eliminates redundant path segments from the variable and
+ :: optionally adds new segmants.
+ :: Example: CALL :trimPath:PATH
+ :: Example: CALL :trimPath:PATH "C:\A & B" C:\a\b\c
+ ::
+ :: Note that only a colon separates the subroutine name and
+ :: the name of the variable to be edited.
+ :: - Frank Westlake, https://github.com/FrankWestlake
+ SetLocal EnableExtensions EnableDelayedExpansion
+ For /F "tokens=2 delims=:" %%a in ("%0") Do (
+ For %%a in (%* !%%a!) Do (
+ Set "#=%%~a"
+ For %%b in (!new!) Do If /I "!#!" EQU "%%~b" Set "#="
+ If DEFINED # (
+ If DEFINED new (Set "new=!new!;!#!") Else ( Set "new=!#!")
+ )
+ )
+ )
+ EndLocal & For /F "tokens=2 delims=:" %%a in ("%0") Do Set "%%a=%new%"
+ Goto :EOF
+
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+:Rhelp
+
+echo (c) 2013 G. Grothendieck
+echo License: GPL 2.0 ( http://www.gnu.org/licenses/gpl-2.0.html )
+echo Launch script for R and associated functions.
+echo Usage: R.bat [subcommand] [arguments]
+echo Subcommands where (0) means takes no arguments; (A) means may need Admin priv
+echo cd - cd to R_ROOT, typically to C:\Program Files\R (0)
+echo cmd - Run Rcmd.exe
+echo dir - List contents of R_ROOT in chronological order showing R versions (0)
+echo gui - Run Rgui.exe
+echo help - Help info (0)
+echo path - Add R_TOOLS, R_MIKTEX ^& R_PATH to path for this cmd line session (0)
+echo R - Run R.exe (0)
+echo script - Run Rscript.exe
+echo show - Show R_ variable values used. R_PATH, etc. (0)
+echo SetReg - Run RSetReg; see 2.17 in R FAQ for Windows (A)
+echo tools - Add R_TOOLS and R_MIKTEX to path for this cmd line session (0)
+echo touch - Change date on R_HOME to now (0) (A)
+echo Examples
+echo R -- invoke R.exe R gui -- invoke Rgui.exe
+echo R dir -- show R versions R show -- show R_ variables
+echo R CMD build mypkg -- builds mypkg
+echo cmd /c set R_VER=R-2.14.0 ^& R gui -- run indicated Rgui version
+echo cmd /c set R_ARCH=32 ^^^& R gui -- run 32 bit Rgui
+echo cmd /c R_VER=R-2.14.0 ^^^& R setreg - make 2.14.0 current in registry
+echo cmd /c R_VER=R-2.14.0 ^^^& R.bat touch - change date on R-2.14.0 dir to now
+goto:eof
+echo.
+echo Run Rgui using a different version of R. R_HOME only affects R session
+echo but not cmd line session.
+echo cmd /c set R_HOME=%ProgramFiles%\R\R-2.14.0 ^& R gui
+echo
+echo Launch a new cmd line window in which R_HOME is as set and launch R:
+echo start set R_HOME=%ProgramFiles%\R\R-2.14.0 ^& R gui
+echo
+echo ==Customization by renaming==
+echo.
+echo If the optional first argument is missing then it uses the value of
+echo the environment variable R_CMD or if that is not set it uses the name of
+echo the script file as the default first argument. The idea is one could have
+echo multiple versions of the script called R.bat, Rgui.bat, etc. which invoke
+echo the corresponding functionality without having to specify first argument.
+echo.
+echo ==Customization by setting environment variables at top of script==
+echo.
+echo It can be customized by setting any of R_CMD, R_HOME, R_ARCH,
+echo R_MIKTEX_PATH, R_TOOLS after the @echo off command at the top of the
+echo script. R_CMD will be used as the default first argument (instead of the
+echo script name).
+echo.
+echo e.g. use the following after @echo off to force 32-bit
+echo set R_ARCH=32
+echo.
+echo e.g. use the following after @echo off to force a particular version of
+echo R to be used
+echo set R_HOME=%ProgramFiles%\R\R-2.14.0
+echo.
+echo e.g. use the following after @echo off to change the default command to
+echo Rgui even if the script is called myRgui.bat, say:
+echo set R_CMD=Rgui
+echo.
+echo ==Installation==
+echo.
+echo The script is self contained so just place it anywhere on your Windows
+echo PATH. (From the Windows cmd line the command PATH shows your current
+echo Windows path.) You may optionally make copies of this script with names
+echo like R.bat, Rscript.bat, Rcmd.bat so that each has a different default.
+echo.
+
Added: grass/trunk/mswindows/external/rbatch/README
===================================================================
--- grass/trunk/mswindows/external/rbatch/README (rev 0)
+++ grass/trunk/mswindows/external/rbatch/README 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,6 @@
+
+Home page: http://batchfiles.googlecode.com
+Documentation: batchfiles.pdf
+Discuss: http://groups.google.com/group/sqldf ** NEW **
+License: LICENSE, COPYING
+
Added: grass/trunk/mswindows/external/rbatch/README.html
===================================================================
--- grass/trunk/mswindows/external/rbatch/README.html (rev 0)
+++ grass/trunk/mswindows/external/rbatch/README.html 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,9 @@
+
+<h1>Batchfiles</h1>
+
+<p>
+Home Page: <A href="http://batchfiles.googlecode.com">batchfiles home page</a>.
+<p>
+Discuss: <a href="http://groups.google.com/group/sqldf">sqldf dicussion group</a> is being used for discussion of this software too.
+<p>
+SVN: <a href="https://code.google.com/p/batchfiles/source/checkout">source</a>
Added: grass/trunk/mswindows/external/rbatch/RESOURCES
===================================================================
--- grass/trunk/mswindows/external/rbatch/RESOURCES (rev 0)
+++ grass/trunk/mswindows/external/rbatch/RESOURCES 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,43 @@
+GENERAL RESOURCES ON WINDOWS BATCH FILE PROGRAMMMING
+----------------------------------------------------
+
+The Windows command line commands will bring up help information
+that is particularly useful:
+
+ help set
+ help for
+ help if
+
+Here are some links on Windows batch file programmming.
+
+ ftp://garbo.uwasa.fi/pc/link/tscmd.zip - FAQ with many idioms
+
+ http://gearbox.maem.umr.edu/batch/f_w_util/ - Frank Westlake utilities
+
+ http://gearbox.maem.umr.edu/fwu/ - more Frank Westlake utilities
+
+ http://groups-beta.google.com/group/alt.msdos.batch.nt/msg/5a9587e871c27a75 - cmd bugs
+
+ http://groups-beta.google.com/group/alt.msdos.batch/msg/7b1d22945c89af75 - cmd help resources
+
+ http://msdn.microsoft.com/downloads/list/webdev.asp - Windows script downloads
+
+ http://thesystemguard.com/TheGuardBook/CCS-Int/ - info on batch commands
+
+ http://www.allenware.com/icsw/icswref.htm - info on batch commands
+
+ http://www.commandline.co.uk - Ritchie Lawrence cmd line utilities
+
+ http://www.cybermesa.com/~bstewart/ - Bill Stewarts scripting tools
+
+ http://www.fpschultze.de - FP Shcultzes batch tricks
+
+ http://www.microsoft.com/technet/community/columns/scripts - MS TechNet scripting
+
+ http://www.paulsadowski.com/WSH/cmdutils.htm - Paul Sadowski batch info
+
+ http://www.ss64.com/nt/index.html - batch command reference
+
+ http://www.vlaurie.com/computers2/Articles/rundll32.htm - rundll for batch scripts
+
+
Added: grass/trunk/mswindows/external/rbatch/Rpathset.bat
===================================================================
--- grass/trunk/mswindows/external/rbatch/Rpathset.bat (rev 0)
+++ grass/trunk/mswindows/external/rbatch/Rpathset.bat 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,92 @@
+:: Software and documentation is (c) 2013 GKX Associates Inc. and
+:: licensed under [GPL 2.0](http://www.gnu.org/licenses/gpl-2.0.html).
+
+:: Purpose: setup path to use R, Rtools and other utilities from cmd line.
+::
+:: Makes no permanent system changes. Does not read or write registry.
+:: Temporarily prepends to PATH and sets environment variables for current
+:: Windows cmd line session only.
+::
+:: Use: Run this each time you launch cmd.exe and want to use R or Rtools.
+:: Can also use it like this: Rpathset Rgui
+:: where Rgui may be replaced with R, Rscript, etc.
+::
+:: Install: Modify set statements appropriately for your installation.
+:: and then place this batch script anywhre on your existing path.
+:: (The Windows commandline command PATH shows the current PATH.)
+::
+:: In many cases no changes are needed at all in this file.
+:: R_HOME and R_ARCH are the most likely that may need to be changed.
+::
+:: Report bugs to:
+:: ggrothendieck at gmail.com
+::
+:: License: GPL 2.0
+
+:: Go into R and issue this command: normalizePath(R.home())
+:: and use its output as the value here. If you upgrade R to another
+:: version R_HOME will change.
+:: R is available from: http://www.r-project.org
+set R_HOME=C:\Program Files\R\R-2.15.3
+
+:: 32 or 64 bit version of R.
+:: (If you wish to use both versions of R make two versions of this file.)
+:: set R_ARCH=i386
+set R_ARCH=x64
+
+:: If in future R changes where it puts its executables then change accordingly
+set R_PATH=%R_HOME%\bin\%R_ARCH%
+
+:: directory path where Rtools was installed. Usually best to use default
+:: which is the one shown below. Note that different versions of R may
+:: require different versions of Rtools.
+:: Rtools is available from: http://cran.r-project.org/bin/windows/Rtools/
+set R_TOOLS=C:\Rtools
+
+:: If in future Rtools changes the required paths then modify accordingly.
+:: To check, run the following findstr command which lists the R_TOOLS_PATH
+:: (plus some garbage):
+:: findstr {app} %R_TOOLS%\unins000.dat
+set R_TOOLS_PATH=%R_TOOLS%\bin;%R_TOOLS%\gcc-4.6.3\bin
+
+:: From within R, the R_USER directory path can be viewed like this:
+:: cat(normalizePath('~'))
+:: It contains your personal .Rprofile, if any, and unless set otherwise
+:: %R_USER%\R\win-library contains your personal R library of packages
+:: (from CRAN and elsewhere).
+set R_USER=%userprofile%\Documents
+
+:: This reduces the verbosity of certain Cygwin tools
+:: (Unfortunately, it seems to have no effect on some Windows systems.)
+set CYGWIN=nodosfilewarning
+
+:: Displays Rtools version in use
+type %R_TOOLS%\version.txt
+
+:: MiKTeX path. Used to build R packages from source.
+:: This is the directory containing pdflatex.exe
+:: MiKTeX is available from http://miktex.org
+set R_MIKTEX_PATH=C:\Program Files (x86)\MiKTeX 2.9\miktex\bin
+
+:: This is only needed when building RMySQL package from source
+:: It is not needed to run RMySQL once its built.
+:: set MYSQL_HOME=C:\Program Files\MySQL\MySQL Server 5.1
+
+:: This is only needed to run JGR and Deducer.
+:: R_LIBS is the system library.
+:: If you have installed at least one package (at which point R will ask to
+:: set up a personal library -- which you should allow) then R_LIBS_USER
+:: is similar to output of .libPaths() with first comnponent being your
+:: personal library and second compnent being library holding packages that
+:: come with R.
+:: Be sure NOT to store the packages that you downloaded from CRAN
+:: in the %R_HOME%\library directory.
+:: set R_LIBS=%R_USER%\R\win-library\2.15
+:: set R_LIBS_USER=%R_LIBS%;%R_HOME%\library
+
+:: adds directory to path for the remainder of current cmd line session
+path %R_TOOLS_PATH%;%R_MIKTEX_PATH%;%PATH%;%R_PATH%
+
+:: if there are no arguments we are done; else run the argument
+if "%1"=="" goto:eof
+%*
Added: grass/trunk/mswindows/external/rbatch/THANKS
===================================================================
--- grass/trunk/mswindows/external/rbatch/THANKS (rev 0)
+++ grass/trunk/mswindows/external/rbatch/THANKS 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,36 @@
+
+Thanks to the following for code:
+
+ Nicholas Hirschey <<Nicholas.Hirschey at phd.mccombs.utexas.edu>
+ Dieter Menne <dieter.menne at menne-biomed.de>
+ Erich Neuwirth <erich.neuwirth at univie.ac.at>
+ Frank Westlake
+
+Thanks to the following for locating bugs:
+
+ Nicholas Hirschey <<Nicholas.Hirschey at phd.mccombs.utexas.edu>
+ Xiaohua Dai <ecoinformatics at gmail.com>
+
+Thanks to the following people for discussion related to R:
+
+ Henrik Bengtsson <henrikb at braju.com>
+ J. Hosking <jh910 at juno.com>
+ Uwe Ligges <ligges at statistik.uni-dortmund.de>
+ Duncan Murdoch <murdoch at stats.uwo.ca>
+ Tobias Verbeke <tobias.verbeke at telenet.be>
+
+Also thanks to the following for discussion related to Windows batch:
+
+ William Allen
+ billious
+ carlos
+ Clay Calvert
+ Ted Davis
+ Al Dunbar
+ foxidrive
+ Phil Robyn
+ Paul R. Sadowski
+ Timo Salmi
+ Tomek (T3X)
+ Matthias Tacke
+
Added: grass/trunk/mswindows/external/rbatch/batchfiles.md
===================================================================
--- grass/trunk/mswindows/external/rbatch/batchfiles.md (rev 0)
+++ grass/trunk/mswindows/external/rbatch/batchfiles.md 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,406 @@
+# Windows Batch Files for R #
+
+G. Grothendieck
+
+Software and documentation is (c) 2013 GKX Associates Inc. and licensed under [GPL 2.0](http://www.gnu.org/licenses/gpl-2.0.html).
+
+## Introduction ##
+
+This document describes a number of Windows batch, javascript and `.hta` files
+that may be used in conjunction with R. Each is self contained and independent
+of the others. None requires installation - just place on the Windows path or
+in current directory. ^[To display the Windows path enter `path` without
+arguments at the Windows `cmd` line. To display the path to the current
+directory enter `cd` without arguments at the Windows `cmd` line.]
+
+`R.bat` and `Rpathset.bat` are alternatives to each other intended to
+facilitate the use of R without permanently modifying the Windows
+configuration. They can also be useful on systems with
+restricted access to the registry.
+`R.bat` uses heuristics to automatically locate `R`, `MiKTeX` and `Rtools`. In
+contrast, `Rpathset.bat` takes a simpler approach of having the user manually
+edit the `set` statements in it. `R.bat` does not require changes when you
+install a new version of R. It will automatically detect this; however,
+`Rpathset.bat` will require that the `set` statements be modified
+appropriately. `R.bat help` gives a quick overview and some examples. Another
+way to use `R.bat` is to copy it to `#Rscript.bat` in which case a call to
+the new
+version can be placed in the first line of any R script to turn it into a
+Windows batch file (as described later).
+
+`movedir.bat` and `copydir.bat` are used for moving or copying packages from
+one library to another such as when R is upgraded to a new version.
+
+`el.js` runs its arguments in elevated mode (i.e. with Administrator
+privileges).
+
+`clip2r.js` copies the current clipboard into a running R instance. It can be
+used with `vim` or other text editor.
+
+`find-miktex.hta` displays a popup window showing where it found MiKTeX.
+
+## R.bat ##
+
+### Purpose ###
+
+The purpose of `R.bat` is to facilitiate the use of R from the Windows `cmd`
+line by eliminating the need to make any system changes. There is no need to
+modify the Windows path or to set any environment variables for standard
+configurations of R. It will automatically locate R (and Rtools and
+MiKTeX if installed) and then run `R.exe`, `Rgui.exe` or other command.
+
+Another scenario for which it is useful is when there are only restricted
+permissions available such as no ability to write to the registry.
+Windows supports 4 sets of environment variables (system, user, volatile,
+process) and the first three are stored in the registry but the last
+is stored only in the local process.
+`R.bat` can work with process environment variables so it can be used in
+such situations where there are minimal permissions.
+
+Like all the other utilities here, `R.bat` is a self contained no-install script
+with no dependencies so just place it anywhere on your Windows path or in the
+current directory.
+
+### Typical Usage ###
+
+Typical usage of `R.bat` to launch R gui is the following ^[
+If `R.exe` were on the Windows path and before `R.bat` then it would
+have to be written as follows: `R.bat gui`]:
+
+ R gui
+
+
+This runs `Rgui.exe`. If further arguments are specified they are passed on to
+`Rgui.exe`. For example,
+
+ R gui --help
+
+will run:
+
+ Rgui.exe --help
+
+### Subcommands ###
+
+If the first argument is optionally one of `cd`, `cmd`, `dir`, `gui`, `help`,
+`path`, `R`, `script`, `show`, `SetReg`, `tools`, `touch` or the same except
+for upper/lower case then that argument is referred to as the subcommand.
+
+If no subcommand is provided then the default subcommand is derived from the
+name of the script.
+
+If the script is named `R.bat` then the subcommand `R` is implied. If the
+script has been renamed then any leading `R` is removed from the name and the
+remainder becomes the default subcommand. For example, if `R.bat` were renamed
+`Rgui.bat` then issuing `Rgui` would be the same as running `R gui` .
+
+### Other R Executables ###
+
+Other executable files that come with R (`R.exe`, `Rcmd.exe`, `Rscript.exe`)
+can be run in a similar way:
+
+ R --help
+ R cmd --help
+ R script --help
+
+(`RSetReg.exe` is another executable that comes with R for Windows. It will be
+discussed later.)
+
+### Support Subcommands ###
+
+There are also some support commands:
+
+ R cd
+ R dir
+ R ls
+ R help
+ R show
+
+`R cd` changes directory to the `R_ROOT` directory (typically
+`C:\Program Files\R`).
+
+`R dir` displays the contents of that directory in chronological order - oldest
+first and most recent last. `R ls` is the same as `R dir`.
+
+`R show` shows the values of the `R_` environment variables used by `R.bat` .
+Below is a list with typical values. These values are determined by the script
+heuristically (or the user can set any before running `R.bat` or
+`R.bat` itself can be customized by setting any of them near top of the script).
+
+ R_ARCH=x64
+ R_CMD=RShow
+ R_HOME=C:\Program Files\R\R-2.15.3
+ R_MIKTEX_PATH=\Program Files (x86)\MiKTeX 2.9\miktex\bin
+ R_PATH=C:\Program Files\R\R-2.15.3\bin\x64
+ R_REGISTRY=1
+ R_ROOT=C:\Program Files\R
+ R_TOOLS=C:\Rtools
+ R_TOOLS_PATH=C:\Rtools\bin;C:\Rtools\gcc-4.6.3\bin;
+ R_TOOLS_VERSION=3.0.0.1927
+ R_VER=R-2.15.3
+
+`R_PATH`, `R_MIKTEX_PATH` and `R_TOOLS_PATH` are the paths to the directories
+holding the `R`, `MiKTeX` and `Rtools` binaries (i.e. `.exe` files).
+
+`R_CMD` indicates the subcommand or if no subcommand specified then it is
+derived from the name of the script. For example if the script were renamed
+`Rgui.bat` then if no subcommand were specified it would default to `gui`.
+
+`R_ROOT` is the directory holding all the R installations. `R_HOME` is the
+directory of the particular R installation. `R_HOME` is made up of `R_ROOT`
+and `R_VER` so that `R_VER` represents the directory that holds the particular
+R version used. `R_ARCH` is `i386` or `x64` for 32 bit or 64 bit R
+respectively. It can also be specified as `32` or `64` in which case it will
+be translated automatically. See the `R show` output above for examples of
+values for these variables.
+
+### Path Setting Subcommands ###
+
+The command
+
+ R path
+
+adds `R_PATH`, `R_MIKTEX_PATH` and `R_TOOLS` to the Windows path for the
+current `cmd` line session. No other `cmd` line sessions are affected and
+there are no permanent changes to the system. Once this is run
+the R binaries will be on the path so they can be accessed directly without
+`R.bat` within the same Windows cmd line session.
+
+This mode of operation has the advantage that startup will be slightly faster
+since `R.bat` will not have to run each time that `R` is started. ^[On a
+1.9 GHz Windows 8 machine `R.bat show` runs in 0.75 seconds.]
+
+Note that if both `R.bat` and `R.exe` exist on the Windows path then the first
+on the path will be called if one uses:
+
+ R ...arguments...
+
+thus one may wish to enter `R.bat` or `R.exe` rather than just `R` for clarity.
+
+Alternately, rename `R.bat` to `Rpath.bat` in which case the command `R path`
+becomes just `Rpath` and `R` becomes unambiguous.
+
+(An alternative to `R path` is the `Rpathset.bat` utility which will be
+described later.)
+
+The command
+
+ R tools
+
+is similar to `R path` except only `R_TOOLS_PATH` and `R_MIKTEX_PATH` are
+added to the path (but not `R_PATH`). This might be useful if you need to use
+those utilities without R.
+
+
+### Selecting R Version ###
+
+For R installations using the standard locations and not specifying any of the
+R_ environment variables the registry will determine which version of R is used
+(assuming `R_REGISTRY` is not `0`). If R is not found in the registry or if
+`R_REGISTRY` is `0` then the R
+installation in `R_ROOT` which has the most recent date will be used.
+
+If we enter this at the `cmd` line:
+
+ set R_VER=R-2.14.0
+
+then for the remainder of this `cmd` line session that version will be used.
+If one wishes to use two different R versions at once we could spawn a new `cmd`
+line session:
+
+ start
+
+and then enter the same set command into the new window. Now any use of R in
+the original window will use the default version whereas in the new `cmd` line
+window it will use the specified version.
+
+One can change the registry entry permanently to refer to a particlar version
+like this:
+
+ cmd /c set R_VER=R-2.14.0 ^& R SetReg
+
+This requires Administrator privileges. If not already running as
+Administrator a window will pop up requesting permission to proceed.
+
+If the registry is empty or `R_REGISTRY=0` then the default version is not
+determined by the registry but is
+determined by which R install directory is the most recent. To make a
+particular R install directory the most recent run the following in a `cmd`
+line session with Administrator privileges:
+
+ R dir
+ el cmd /c set R_VER=R-2.14.0 ^& R touch
+
+The value of `R_VER` in the above line must be one of the directories listed
+by `R dir`. The `el.js` command used in the above code comes with these batch
+files and provides one way to elevate commands to have Administrator
+privileges.
+
+Note that `R SetReg` and `R touch` make permanent changes to the system
+(namely installing or uninstalling the R key and updating the date on a
+particular R directory, respectively) but the other subcommands make no
+permanent changes.
+
+### Heuristic to Locate R ###
+
+1. If `.\Rgui.exe` exists use implied `R_PATH` and skip remaining points.
+
+2. If `.\{x64,i386}\Rgui.exe` or `.\bin\{x64,i386}\Rgui.exe` exists use implied
+`R_HOME`.
+
+3. If `R_HOME` defined then derive any of `R_ROOT` and `R_VER` that are not
+already defined.
+
+4. If `R_PATH` defined then derive any of `R_ROOT`, `R_HOME`, `R_VER` and
+`R_ARCH` that are not already defined.
+
+5. If `R_REGISTRY=1` and R found in registry derive any of `R_HOME`, `R_ROOT`
+and `R_VER` that are not already defined.
+
+6. If R_ROOT not defined try `%ProgramFiles%\R\*`, `%ProgramFiles(x86)%\R\*`
+ and then `%SystemRoot%\R` else error.
+
+7. If `R_VER` not defined use last directory in `cd %R_ROOT% & dir /od`.
+
+8. if `R_ARCH` not defined try `%R_ROOT%\%R_VER%\bin\x64\Rgui.exe` and then
+ `%R_ROOT%\%R_VER%\bin\i386\Rgui.exe`
+
+9. If `R_ROOT`, `R_VER` and `R_ARCH` defined skip remaining points.
+
+10. If `Rgui.exe` found on `PATH` use implied `R_PATH`.
+
+## #Rscript.bat ##
+
+This is not a separate batch file but is yet another way to call `R.bat`.
+Its purpose is to turn an R script into a Windows batch file.
+
+1. Copy `R.bat` to a file with the name `#Rscript.bat` like this
+(from the Windows cmd line):
+
+ copy R.bat #Rscript.bat
+
+2. Ensure that `#Rscript.bat` is on your windows path. Then we can turn an
+R script into a `.bat` file by
+(a) giving the R script a `.bat` extension and
+(b) putting this line as the
+first line in the script: `#Rscript %0 %*`
+
+This makes the script both a Windows batch file and an R script at the same
+time. When run as a batch file it will invoke `#Rscript.bat` which in turn
+will self call the script as an R script. (It would also be possible to
+run the script directly as an R script. In that case the #Rscript line would
+be ignored since it would be regarded as a comment by R.)
+
+For example, if we have a file `test.bat` with the following two lines:
+
+ #Rscript %0 %*
+ print(pi)
+
+then we can invoke it from the Windows cmd line like this:
+
+ test
+
+## #Rscript2.bat ##
+
+This batch file is used in exactly the same manner as #Rscript.bat . The only
+difference is that unlike #Rscript.bat which automatically finds R with this
+script the user must edit it to indicate where R is located. Although this
+involves an extra installation step in return the script is very simple so
+its less likely to go wrong and if something does go wrong then its relatively
+simple to fix since the script itself is simple.
+
+If you have a 64 bit system then the only part that needs to be changed is
+changing the definition of R_HOME to point to your version of R. If you
+have a 32 bit system then you will also have to modify the definition of
+R_ARCH on the appropriate line.
+
+There is more information on this in the comments at the top of the script.
+
+## Rpathset.bat ##
+
+The command
+
+ Rpathset
+
+adds `R_PATH`, `R_MIKTEX_PATH` and `R_TOOLS` to the Windows path for the
+current `cmd` line session. No other `cmd` line sessions are affected and
+there are no permanent changes to the system. Once this is run
+the R binaries will be on the path so they can be accessed directly without
+`R.bat` .
+
+`Rpathset` is an alternative to
+
+ R path
+
+but unlike `R.bat`, `Rpathset.bat` does not have any automatic heuristics.
+Instead, it requires that the user manually set the relevant variables in its
+source. Running `Rpathset.bat` then sets the path accordingly and from then on
+in the session one can access `Rgui.exe`, etc. on the path. Although
+`Rpathset.bat` involves manual editing it does have the advantage that as a
+consequence it is very simple -- not much more than a collection of Windows
+batch set commands. This makes it easy to customize, less fragile to
+changes in the install procedures of `R` itself and is also more liklely to
+work on untested Windows configurations.
+
+`Rpathset.bat` might be used like this:
+
+ Rpathset
+ Rgui
+
+where `Rgui` is now directly accessing `Rgui.exe` as `Rpathset.bat` has added
+`R_PATH` to the Windows path.
+
+The set statements are documented in the source of the `Rpathset.bat` file
+itself.
+
+## movedir.bat and copydir.bat ##
+
+`movedir.bat` and `copydir.bat` move or copy the packages from one library to
+another. If used to transfer packages from one version of R to another it is
+recommended that the user run `upgrade.packages()` in the target. For example,
+assuming the default location for the user libraries:
+
+ cd %userprofile%\Documents\win-library
+ copydir 2.15\library 3.0\library
+
+ R.bat gui
+ ... now enter update.packages(checkBuilt=TRUE) into R...
+
+(The `checkBuilt=TRUE` argument forces a rebuild and is normally not required
+when upgrading to another version that differs only in the minor version
+number, e.g. from 2.15.2 to 2.15.3.)
+
+`movedir.bat` and `copydir.bat` will not overwrite any existing package in the
+target library so they are particularly safe to use. (If you do wish to
+overwrite such packages delete them from the target first using the Windows
+`del` command.)
+
+
+## el.js ##
+
+`el.js` runs its arguments elevated (i.e. with Adminstrator privileges). For example,
+
+ el R touch
+
+The user will be prompted to allow elevation to proceed.
+
+## clip2r.js ##
+
+This program writes the clipboard into the running R session. It can be used
+with `vim` or other editor. See the source for additional instructions.
+
+## find-mixtex.hta ##
+
+This program displays a window showing where MiKTeX was found. It uses the
+MiKTeX API. This API is not used by `R.bat` . Instead `R.bat` just looks in
+common places. (Using this API may be incorporated into the `R.bat` heuristic
+in the future.)
+
+## make-batchfiles-pdf.bat ##
+
+This batch file creates a pdf of this documentation from the markdown file
+`batchfiles.md` . `pandoc` must be installed for this to run. `pandoc` can be
+found [here](https://code.google.com/p/pandoc/downloads/list). It is run
+without arguments:
+
+ make-batchfiles-pdf
+
Added: grass/trunk/mswindows/external/rbatch/batchfiles.tex
===================================================================
--- grass/trunk/mswindows/external/rbatch/batchfiles.tex (rev 0)
+++ grass/trunk/mswindows/external/rbatch/batchfiles.tex 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,322 @@
+\section{Windows Batch Files for R}
+
+G. Grothendieck
+
+Software and documentation is (c) 2013 GKX Associates Inc. and licensed
+under \href{http://www.gnu.org/licenses/gpl-2.0.html}{GPL 2.0}.
+
+\subsection{Introduction}
+
+This document describes a number of Windows batch, javascript and
+\texttt{.hta} files that may be used in conjunction with R. Each is self
+contained and independent of the others. Each requires no installation -
+just place it on the Windows path\footnote{To display the Windows path
+ enter \texttt{path} at the Windows \texttt{cmd} line.}.
+
+\texttt{R.bat} and \texttt{Rpathset.bat} are alternatives to each other
+intended to facilitate the use of R without having to permanently modify
+the Windows system PATH or otherwise use the Windows control panel.
+\texttt{R.bat} uses heuristics to automatically locate \texttt{R},
+\texttt{MiKTeX} and \texttt{Rtools} while \texttt{Rpathset.bat} takes a
+simpler approach of having the user manually edit the \texttt{set}
+statements in it to configure it. \texttt{R.bat} does not require
+changes when you install a new version of R but \texttt{Rpathset.bat}
+does. \texttt{R.bat help} gives a quick overview of that batch file.
+
+\texttt{movedir.bat} and \texttt{copydir.bat} are used for moving or
+copying packages from one library to another.
+
+\texttt{el.js} runs its arguments in elevated mode (i.e.~with
+Administrator privileges).
+
+\texttt{clip2r.js} copies the current clipboard into a running R
+instance. It can be used with vim or other text editor.
+
+\texttt{find-miktex.hta} displays a popup window showing where it found
+MiKTeX.
+
+\subsection{R.bat}
+
+\subsubsection{Purpose}
+
+The purpose of R.bat is to facilitiate the use of R from the Windows
+\texttt{cmd} line by eliminating the need to make any systems changes.
+There is no need to modify the Windows PATH or to set any environment
+variables for standard configurations of R. It will automatically locate
+R (and Rtools and MiKTeX if installed) and then run \texttt{R.exe},
+\texttt{Rgui.exe} or other command.
+
+It is a self contained no-install script with no dependencies so just
+place it anywhere on your Windows path.
+
+\subsubsection{Typical Usage}
+
+Typical usage to launch R gui is the following:
+
+\begin{verbatim}
+R.bat gui
+\end{verbatim}
+
+If R.exe is not on the Windows path or is after R.bat on the path then
+the above can be shortened to:
+
+\begin{verbatim}
+R gui
+\end{verbatim}
+
+Either of these commands runs \texttt{Rgui.exe} along with further
+arguments, if any. For example,
+
+\begin{verbatim}
+R.bat gui --help
+\end{verbatim}
+
+will run:
+
+\begin{verbatim}
+Rgui.exe --help
+\end{verbatim}
+
+\subsubsection{Other R Executables}
+
+Other executable files that come with R (\texttt{R.exe},
+\texttt{Rcmd.exe}, \texttt{Rscript.exe}) can be run in a similar way:
+
+\begin{verbatim}
+R.bat --help
+R.bat cmd --help
+R.bat script --help
+\end{verbatim}
+
+(\texttt{RSetReg.exe} is another executable that comes with R for
+Windows. It will be discussed later.)
+
+\subsubsection{Support Subcommands}
+
+There are also some support commands:
+
+\begin{verbatim}
+R.bat cd
+R.bat dir
+R.bat help
+R.bat show
+\end{verbatim}
+
+\texttt{R.bat cd} changes to the \texttt{R\_ROOT} directory (typically
+\texttt{C:\textbackslash{}\textbackslash{}Program Files\textbackslash{}\textbackslash{}R}).
+
+\texttt{R.bat dir} displays the contents of that directory.
+
+\texttt{R.bat show} shows the values of the \texttt{R\_} environment
+that \texttt{R.bat} uses. Here is a list with typical values. These
+values are determined by the script heuristically (or the user can set
+any before running \texttt{R.bat} or by customizing \texttt{R.bat}
+itself by setting any of them near top of the script).
+
+\begin{verbatim}
+R_ARCH=x64
+R_CMD=RShow
+R_HOME=C:\\Program Files\\R\\R-2.15.2
+R_MIKTEX_PATH=\\Program Files (x86)\\MiKTeX 2.9\\miktex\\bin
+R_PATH=C:\\Program Files\\R\\R-2.15.2\\bin\\x64
+R_REGISTRY=1
+R_ROOT=C:\\Program Files\\R
+R_TOOLS=C:\\Rtools
+R_TOOLS_PATH=C:\\Rtools\\bin;C:\\Rtools\\gcc-4.6.3\\bin;
+R_TOOLS_VERSION=3.0.0.1927
+R_VER=R-2.15.2
+\end{verbatim}
+
+\texttt{R\_PATH}, \texttt{R\_MIKTEX\_PATH} and \texttt{R\_TOOLS\_PATH}
+are the paths to the directories holding the \texttt{R}, \texttt{MiKTeX}
+and \texttt{Rtools} binaries.
+
+\texttt{R\_CMD} indicates the subcommand or if no subcommand specified
+then is derived from the name of the script. For example if the script
+were renamed \texttt{Rgui.bat} then if no subcommand were specified it
+would default to \texttt{gui}.
+
+\texttt{R\_ROOT} is the directory holding all the R installations.
+\texttt{R\_HOME} is the directory of the particular R installation.
+\texttt{R\_HOME} is made up of \texttt{R\_ROOT} and \texttt{R\_VER} so
+that \texttt{R\_VER} represents the directory that holds the particular
+R version used. \texttt{R\_ARCH} is \texttt{i386} or \texttt{x64} for 32
+bit or 64 bit R respectively. It can also be specified as \texttt{32} or
+\texttt{64} in which case it will be translated automatically.
+
+\subsubsection{Path Setting Subcommands}
+
+The command
+
+\begin{verbatim}
+R.bat path
+\end{verbatim}
+
+adds \texttt{R\_PATH}, \texttt{R\_MIKTEX\_PATH} and \texttt{R\_TOOLS} to
+the Windows path for the current \texttt{cmd} line session. No other
+\texttt{cmd} line sessions are affected and there are no permanent
+changes to the system. Once this is run one no longer needs R.bat in the
+current session as the R binaries such as \texttt{R.exe},
+\texttt{Rgui.exe} will be directly on the path. (An alternative to this
+is the \texttt{Rpathset.bat} utility which will be desribed later.)
+
+\begin{verbatim}
+R.bat tools
+\end{verbatim}
+
+is similar except only \texttt{R\_TOOLS\_PATH} and
+\texttt{R\_MIKTEX\_PATH} are added to the path. This might be useful if
+you need to use those utilities without R.
+
+\subsubsection{Selecting R Version}
+
+For R installations using the standard locations and not specifying any
+of the R\_ environment variables the registry will determine which
+version of R is used (assuming \texttt{R\_REGISTRY} is not 0). If R is
+not found in the registry the R installation in \texttt{R\_ROOT} which
+has the most recent date will be used.
+
+We can change which version of R is used like this:
+
+\begin{verbatim}
+set R_VER=R-2.14.0
+\end{verbatim}
+
+and now for the remainder of this \texttt{cmd} line session that version
+will be used. If one wants to use two different R versions at once we
+could spawn a new \texttt{cmd} line session with the new version:
+
+\begin{verbatim}
+start
+\end{verbatim}
+
+and then enter the same set command into the new window. Now any use of
+R in the original window will use the default version and in the new
+version will use the specified version.
+
+One can change the registry entry permanently to refer to a particlar
+version like this:
+
+\begin{verbatim}
+cmd /c set R_VER=R-2.14.0 ^& R.bat SetReg
+\end{verbatim}
+
+This requires Administrator privileges so a window will pop up
+requesting permission to proceed.
+
+If the registry is empty or \texttt{R\_REGISTRY=0} then the default
+version is determined by which R install directory is the most recent.
+To make a particular R install directory the most recent run the
+following in a \texttt{cmd} line session with Administrator privileges:
+
+\begin{verbatim}
+cmd /c set R_VER=R-2.14.0 ^& R.bat touch
+\end{verbatim}
+
+The \texttt{el.js} command that comes with the batch utilities is one
+way to elevate the command to run with such privileges:
+
+\begin{verbatim}
+el cmd /c set R_VER=R-2.14.0 ^& R.bat touch
+\end{verbatim}
+
+Note that \texttt{R.bat SetReg} and \texttt{R.bat touch} make permanent
+changes to the system (namely installing or uninstalling the R key and
+updating the date on a particular R directory) but the other subcommands
+do not.
+
+\subsubsection{Heuristic to Locate R}
+
+\begin{enumerate}
+\def\labelenumi{\arabic{enumi}.}
+\item
+ If \texttt{.\textbackslash{}\textbackslash{}R.exe} exists use implied
+ \texttt{R\_PATH} and skip remaining points.
+\item
+ If
+ \texttt{.\textbackslash{}\textbackslash{}\{x64,i386\}\textbackslash{}\textbackslash{}R.exe}
+ or
+ \texttt{.\textbackslash{}\textbackslash{}bin\textbackslash{}\textbackslash{}\{x64,i386\}\textbackslash{}\textbackslash{}R.exe}
+ exists use implied \texttt{R\_HOME}.
+\item
+ If \texttt{R\_HOME} defined then derive any of \texttt{R\_ROOT} and
+ \texttt{R\_VER} that are not already defined.
+\item
+ If \texttt{R\_PATH} defined then derive any of \texttt{R\_ROOT},
+ \texttt{R\_HOME}, \texttt{R\_VER} and \texttt{R\_ARCH} that are not
+ already defined.
+\item
+ If \texttt{R\_REGISTRY=1} and R found in registry derive any of
+ \texttt{R\_HOME}, \texttt{R\_ROOT} and \texttt{R\_VER} that are not
+ already defined.
+\item
+ If R\_ROOT not defined try
+ \texttt{\%ProgramFiles\%\textbackslash{}\textbackslash{}R\textbackslash{}\textbackslash{}*},
+ \texttt{\%ProgramFiles(x86)\%\textbackslash{}\textbackslash{}R\textbackslash{}\textbackslash{}*}
+ and then \texttt{\%SystemRoot\%\textbackslash{}\textbackslash{}R} else
+ error.
+\item
+ If \texttt{R\_VER} not defined use last directory in
+ \texttt{cd \%R\_ROOT\% \& dir /od}.
+\item
+ if \texttt{R\_ARCH} not defined try
+ \texttt{\%R\_ROOT\%\textbackslash{}\textbackslash{}\%}R\_VER\texttt{\%\textbackslash{}\textbackslash{}bin\textbackslash{}\textbackslash{}x64\textbackslash{}\textbackslash{}R.exe}
+ and then
+ \texttt{\%R\_ROOT\%\textbackslash{}\textbackslash{}\%}R\_VER\texttt{\%\textbackslash{}\textbackslash{}bin\textbackslash{}\textbackslash{}i386\textbackslash{}\textbackslash{}R.exe}
+\item
+ If \texttt{R\_ROOT}, \texttt{R\_VER} and \texttt{R\_ARCH} defined skip
+ remaining points.
+\item
+ If \texttt{R.exe} found on \texttt{PATH} use implied \texttt{R\_PATH}.
+\end{enumerate}
+
+\subsection{Rpathset.bat}
+
+An alternative to
+
+\begin{verbatim}
+R.bat path
+\end{verbatim}
+
+is the \texttt{Rpathset.bat}. Unlike \texttt{R.bat},
+\texttt{Rpathset.bat} is not automatic but requires that the user modify
+the various set commands in it. Running \texttt{Rpathset.bat} then sets
+the path accordingly and from then on in the session one can access
+Rgui.exe, etc. on the path. Although \texttt{Rpathset.bat} involves
+manual editing it does have the advantage that as a consequence it is
+very simple -- not much more than a collection of Windows batch set
+commands.
+
+The set statements are documented in the source of the file itself.
+
+\subsection{movedir.bat and copydir.bat}
+
+\texttt{movedir.bat} and \texttt{copydir.bat} move or copy the packages
+from one library to another. If used to transfer packages from one
+version of R to another it is recommended that the user run
+\texttt{upgrade.packages()} in the target. For example, assuming the
+default location for the user libraries:
+
+\begin{verbatim}
+cd %userprofile%\\Documents\\win-library
+copydir 2.15\\library 3.0\\library
+R.bat gui
+... now enter update.packages() into R...
+\end{verbatim}
+
+\subsection{el.js}
+
+\texttt{el.js} runs its arguments elevated (i.e.~with Adminstrator
+privileges).
+
+\subsection{clip2r.js}
+
+This program writes the clipboard into the running R session. It can be
+used with vim or other editor. See the source for additional
+instructions.
+
+\subsection{find-mixtex.hta}
+
+This program displays a window showing where MiKTeX was found. It uses
+the MiKTeX API. This API is not used by \texttt{R.bat} . It may be
+incorporated into \texttt{R.bat} in the future.
Added: grass/trunk/mswindows/external/rbatch/clip2r.js
===================================================================
--- grass/trunk/mswindows/external/rbatch/clip2r.js (rev 0)
+++ grass/trunk/mswindows/external/rbatch/clip2r.js 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,13 @@
+// (c) 2009. Gabor Grothendieck.
+// This is free software licensed under GPL.
+//
+// To use with vim place these two lines in your _vimrc file
+// To find the directory where _vimrc goes enter this in vim :echo $HOME
+//
+// map <F3> <C-C><ESC>:!start cmd /c clip2r.js<CR><CR>
+// imap <F3> <ESC><C-C><ESC>:!start cmd /c clip2r.js<CR><CR>
+
+var wsh = new ActiveXObject("Wscript.Shell");
+wsh.AppActivate("Rgui");
+wsh.SendKeys("% x%{w}1^{v}");
+
Added: grass/trunk/mswindows/external/rbatch/copydir.bat
===================================================================
--- grass/trunk/mswindows/external/rbatch/copydir.bat (rev 0)
+++ grass/trunk/mswindows/external/rbatch/copydir.bat 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,19 @@
+ at echo off
+:: Software and documentation is (c) 2013 GKX Associates Inc. and
+:: licensed under [GPL 2.0](http://www.gnu.org/licenses/gpl-2.0.html).
+setlocal
+if not "%2"=="" goto:run
+echo Usage: copydir fromdir todir
+echo All files/directories in fromdir that do not also exist in todir are
+echo recurisvely copied.
+echo e.g.
+echo cd "%userprofile%\Documents\R\win-library"
+echo copydir 2.14 2.15
+echo Now start up R 2.15.x and issue update.packages()
+goto:eof
+:run
+:: Notes on code:
+:: on xcopy command /e copies subdir/files incl empty ones
+:: on xcopy command /i causes target to be created
+for /D %%a in ("%~1\*") do if not exist %2\%%~na xcopy /e/i "%%a" "%~2\%%~nxa"
+endlocal
Added: grass/trunk/mswindows/external/rbatch/el.js
===================================================================
--- grass/trunk/mswindows/external/rbatch/el.js (rev 0)
+++ grass/trunk/mswindows/external/rbatch/el.js 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,18 @@
+// elevate.js -- runs target command line elevated
+// Arguments should not have embedded spaces.
+// http://blogs.msdn.com/b/aaron_margosis/archive/2007/07/01/scripting-elevation-on-vista.aspx
+if (WScript.Arguments.Length >= 1) {
+ Application = WScript.Arguments(0);
+ Arguments = "";
+ for (Index = 1; Index < WScript.Arguments.Length; Index += 1) {
+ if (Index > 1) {
+ Arguments += " ";
+ }
+ Arguments += WScript.Arguments(Index);
+ }
+ new ActiveXObject("Shell.Application").ShellExecute(Application, Arguments, "", "runas");
+} else {
+ WScript.Echo("Usage:");
+ WScript.Echo("elevate Application Arguments");
+}
+
Added: grass/trunk/mswindows/external/rbatch/find-miktex.hta
===================================================================
--- grass/trunk/mswindows/external/rbatch/find-miktex.hta (rev 0)
+++ grass/trunk/mswindows/external/rbatch/find-miktex.hta 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,31 @@
+<!-- (c) 2013 GKX Associates Inc. -->
+<!-- License: GPL 2.0 -->
+<head>
+<STYLE TYPE="text/css">
+.highlight {background:#ff00ff}
+.text {color:#ff00ff}
+.both {color:white;background:black}
+</STYLE>
+<title>find-miktex</title>
+</head>
+<body onLoad="window.resizeTo(650,250);">
+<h1>Find MiKTeX</h1>
+<script type="text/jscript">
+
+fso = new ActiveXObject("Scripting.FileSystemObject");
+mik = new ActiveXObject("MiKTeX.Session");
+
+i = 0;
+while (true) {
+ try {
+ rt = mik.GetRootDirectory(i);
+ if (fso.FileExists(rt + "\\miktex\\bin\\latex.exe")) {
+ document.write(rt + "\\miktex\\bin<br>");
+ }
+ i++;
+ } catch(e) {break};
+}
+
+</script>
+</body>
+</html>
Added: grass/trunk/mswindows/external/rbatch/make-batchfiles-pdf.bat
===================================================================
--- grass/trunk/mswindows/external/rbatch/make-batchfiles-pdf.bat (rev 0)
+++ grass/trunk/mswindows/external/rbatch/make-batchfiles-pdf.bat 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,6 @@
+
+:: make pdf documentation. To run:
+:: 1. install pandoc from http://code.google.com/p/pandoc/downloads/list
+:: 2. run this file
+
+pandoc batchfiles.md -o batchfiles.pdf
Added: grass/trunk/mswindows/external/rbatch/movedir.bat
===================================================================
--- grass/trunk/mswindows/external/rbatch/movedir.bat (rev 0)
+++ grass/trunk/mswindows/external/rbatch/movedir.bat 2014-04-05 20:47:57 UTC (rev 59585)
@@ -0,0 +1,16 @@
+ at echo off
+:: Software and documentation is (c) 2013 GKX Associates Inc. and
+:: licensed under [GPL 2.0](http://www.gnu.org/licenses/gpl-2.0.html).
+setlocal
+if not "%2"=="" goto:run
+echo Usage: copydir fromdir todir
+echo All files/directories in fromdir that do not also exist in todir are
+echo recurisvely copied.
+echo e.g.
+echo cd "%userprofile%\Documents\R\win-library"
+echo movedir 2.14 2.15
+echo Now start up R 2.15.x and issue update.packages()
+goto:eof
+:run
+for /D %%a in ("%~1\*") do if not exist %2\%%~na move "%%a" "%~2\%%~nxa"
+endlocal
More information about the grass-commit
mailing list