source: grass/trunk/mswindows/external/rbatch/R.bat

Last change on this file was 60187, checked in by hellik, 10 years ago

R-batch files update to rev 149 - step 2: svn propset

  • Property svn:eol-style set to CRLF
  • Property svn:mime-type set to text/x-bat
File size: 18.5 KB
Line 
1@Echo OFF
2
3:: Software and documentation is (c) 2013 GKX Associates Inc. and
4:: licensed under [GPL 2.0](http://www.gnu.org/licenses/gpl-2.0.html).
5
6:: Help is at bottom of script or just run script with single argument: help
7
8:: can optionally uncomment and change these to force certain values. This
9:: is normally unnecessary. Rather one can usually rely on the heuristics to
10:: set them.
11:: set R_CMD=R
12:: set R_HOME=%ProgramFiles%\R\R-2.14.0
13:: set R_ARCH=64
14:: set R_MIKTEX_PATH=%ProgramFiles%\MiKTeX 2.9\miktex\bin
15:: set R_TOOLS=C:\Rtools
16:: set MYSQL_HOME=%ProgramFiles%\MySQL\MysQL Server 5.1
17
18:: 1 means read registry and 0 means ignore registry
19if not defined R_REGISTRY set R_REGISTRY=1
20set CYGWIN=nodosfilewarning
21
22SetLocal EnableExtensions EnableDelayedExpansion
23
24::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
25:: R_CMD
26:: 1. if 1st arg is CMD then set R_CMD to R
27:: 2. else if 1st arg is Rshow, Rpath, Rgui, Rcmd, R or Rscript set R_CMD to it
28:: and remove it from args
29:: 3. else use R_CMD if set
30:: 4. else use %0
31::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
32
33set args=%*
34set cmd=
35if /i "%~1"=="registry" goto:Rregistry
36if /i "%~1"=="cd" set cmd=Rcd
37if /i "%~1"=="CMD" set cmd=Rcmd
38if /i "%~1"=="dir" set cmd=Rdir
39if /i "%~1"=="ls" set cmd=Rdir
40if /i "%~1"=="gui" set cmd=Rgui
41if /i "%~1"=="help" goto:Rhelp
42if /i "%~1"=="path" set cmd=Rpath
43if /i "%~1"=="R" set cmd=R
44if /i "%~1"=="script" set cmd=Rscript
45if /i "%~1"=="show" set cmd=RShow
46if /i "%~1"=="SetReg" set cmd=RSetReg
47if /i "%~1"=="tools" set cmd=Rtools
48if /i "%~1"=="touch" set cmd=Rtouch
49
50if "%cmd%"=="" goto:R_CMD_cont
51if "%2"=="" (set args=) && goto:R_CMD_cont
52set args=xxx%*
53call set args=%%args:xxx%1=%%
54:R_CMD_cont
55if defined cmd set R_CMD=%cmd%
56if not defined R_CMD set R_CMD=%0
57:: set "R_CMD=%R_CMD:.bat=%"
58for %%i in ("%R_CMD%") do set R_CMD=%%~ni
59if /i "%R_CMD%"=="#Rscript" set R_CMD=Rscript
60rem echo R_CMD:%R_CMD% args=[%args%]
61
62:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
63:: 1. If .\Rgui.exe exist use implied R_PATH and skip remaining points.
64:: 2. If .\{x64,i386}\Rgui.exe or .\bin\{x64,i386}\Rgui.exe exists use implied R_HOME.
65:: 3. if R_HOME defined then derive any of R_ROOT and R_VER that
66:: are not already defined.
67:: 4. if R_PATH defined then derive any of R_ROOT, R_HOME, R_VER and R_ARCH that
68:: are not already defined.
69:: 4a. If R_REGISTRY=1 and R found in registry derive any of R_HOME, R_ROOT and
70:: R_VER that are not already defined.
71:: 5. If R_ROOT not defined try %ProgramFiles%\R\*, %ProgramFiles(x86)%\R\*
72:: and then %SystemRoot%\R else error
73:: 6. If R_VER not defined use last directory in cd %R_ROOT% & dir /od
74:: 7. if R_ARCH not defined try %R_ROOT%\%R_VER%\bin\x64\Rgui.exe and then
75:: %R_ROOT%\%R_VER%\bin\i386\Rgui.exe
76:: 8. If R_ROOT, R_VER and R_ARCH defined skip remaining points.
77:: 9. If Rgui.exe found on PATH use implied R_PATH.
78:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
79
80:: 1
81if exist Rgui.exe (
82 pushd ..\..
83 set R_HOME=!CD!
84 popd
85 goto:R_exe_end
86)
87
88:: 2
89if exist x64\Rgui.exe (
90 pushd ..
91 set R_PATH=!CD!\bin\x64
92 popd
93 goto:R_exe_end
94)
95if exist i386\Rgui.exe (
96 pushd ..
97 set R_PATH=!CD!\bin\i386
98 popd
99 goto:R_exe_end
100)
101if exist bin\x64\Rgui.exe set R_PATH=%CD%\bin\x64 & goto:R_exe_end
102if exist bin\i386\Rgui.exe set R_PATH=%CD%\bin\i386
103:R_exe_end
104
105:: 3
106
107if defined R_HOME (
108 pushd
109 cd %R_HOME%
110 if not defined R_VER for /f "delims=" %%a in ("!CD!") do set R_VER=%%~na
111 cd ..
112 if not defined R_ROOT set R_ROOT=!CD!
113 popd
114)
115
116:: 4
117if defined R_PATH (
118 pushd
119 cd %R_PATH%
120 if not defined R_ARCH for /f "delims=" %%a in ("!CD!") do set R_ARCH=%%~na
121 cd ..\..
122 if not defined R_HOME set R_HOME=!CD!
123 if not defined R_VER for /f "delims=" %%a in ("!CD!") do set R_VER=%%~na
124 cd ..
125 if not defined R_ROOT set R_ROOT=!CD!
126 popd
127)
128
129
130:: 4a
131
132if not defined R_HOME for /f "tokens=2*" %%a in (
133 'reg query hklm\software\wow6432Node\r-core\r /v InstallPath 2^>NUL ^| findstr InstallPath'
134 ) do set R_HOME=%%~b
135
136if not defined R_HOME for /f "tokens=2*" %%a in (
137 'reg query hklm\software\R-core\R /v InstallPath 2^>NUL ^| findstr InstallPath'
138 ) do set R_HOME=%%~b
139
140if defined R_HOME (
141 if not defined R_ROOT (
142 pushd %R_HOME%
143 cd ..
144 set R_ROOT=!CD!
145 popd
146 )
147 if not defined R_VER (
148 for /f "delims=" %%a in ("%R_HOME%") do set R_VER=%%~nxa
149 )
150)
151
152
153:: 5
154
155if defined R_ROOT goto:R_ROOT_end
156if exist "%ProgramFiles%\R" set R_ROOT=%ProgramFiles%\R
157if defined R_ROOT goto:R_ROOT_end
158if exist %SystemDrive%\R set R_ROOT=%SystemDrive%\R
159:R_ROOT_end
160
161:: 6
162if defined R_VER goto:R_VER_end
163for /f "delims=" %%a in (
164 'dir /b /od /ad "%R_ROOT%" 2^>NUL'
165) do set R_VER=%%a
166:R_VER_end
167
168:: do we need this?
169if defined R_ROOT if defined R_VER set R_HOME=%R_ROOT%\%R_VER%
170
171:: 7
172if defined R_ARCH goto:R_ARCH_cont
173set R_ARCH=i386
174if exist "%R_HOME%\bin\x64" set R_ARCH=x64
175if exist "%R_ROOT%\%R_VER%\bin\x64" set R_ARCH=x64
176:R_ARCH_cont
177if "%R_ARCH%"=="64" set R_ARCH=x64
178if "%R_ARCH%"=="32" set R_ARCH=i386
179if "%R_ARCH%"=="386" set R_ARCH=i386
180
181:: 8
182if not defined R_ROOT goto:where
183if not defined R_VER goto:where
184if not defined R_ARCH goto:where
185set R_PATH=%R_ROOT%\%R_VER%\bin\%R_ARCH%
186goto:path_end
187
188echo "R not found" & exit /b 1
189
190:: 9
191:where
192where Rgui.exe 1>NUL 2>NUL
193if not errorlevel 1 for /f "delims=" %%a in ('where Rgui.exe') do set R_PATH=%%~pa
194
195:path_end
196
197:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
198:: R_TOOLS
199:: 1. use R_TOOLS if defined. If not
200:: 2. check if ls.exe, rsync.exe and gcc.exe are on PATH. If not
201:: 3. check if Rtools found in registry. If not
202:: 4. check if C:\Rtools exists. If not
203:: 5. R_TOOLS not found.
204:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
205
206if defined R_TOOLS goto:RtoolsEnd
207
208where ls.exe 1> NUL 2> NUL
209if errorlevel 1 goto:RtoolsNotOnPATH
210
211where rsync.exe 1> NUL 2> NUL
212if errorlevel 1 goto:RtoolsNotOnPATH
213
214where gcc.exe 1> NUL 2> NUL
215if errorlevel 1 goto:RtoolsNotOnPATH
216
217for /f "delims=" %%a in ('where rsync.exe') do set R_TOOLS=%%~pa
218pushd %R_TOOLS%
219cd ..
220set R_TOOLS=%CD%
221popd
222goto:RtoolsEnd
223
224:RtoolsNotOnPATH
225
226if not defined R_TOOLS for /f "tokens=2*" %%a in (
227 'reg query hklm\software\R-core\Rtools /v InstallPath 2^>NUL ^| findstr InstallPath'
228 ) do set R_TOOLS=%%~b
229if not defined R_TOOLS for /f "tokens=2*" %%a in (
230 'reg query hklm\software\wow6432Node\Rtools /v InstallPath 2^>NUL ^| findstr InstallPath'
231 ) do set R_TOOLS=%%~b
232
233if exist "C:\Rtools" set R_TOOLS=C:\Rtools
234
235:RToolsEnd
236
237:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
238:: R_TOOLS_PATH
239:: Extract path from: %R_TOOLS%\unins000.dat
240:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
241
242if defined R_TOOLS call :extract_string {app} %R_TOOLS%\unins000.dat
243call set R_TOOLS_PATH=%%final:{app}=%R_TOOLS%%%
244call :trimPath:R_TOOLS_PATH
245
246if defined R_TOOLS for /f "tokens=3" %%a in (%R_TOOLS%\Version.txt) do set R_TOOLS_VERSION=%%a
247
248:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
249:: R_MIKTEX
250:: If R_MIKTEX defined use that
251:: else if pdflatex.exe on PATH use that else
252:: check %ProgramFiles%\miktex* else
253:: check %ProgramFiles(x86)%\miktex* else
254:: check %SystemDrive%\miktex*
255:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
256
257if defined R_MIKTEX_PATH goto:miktex_end
258
259:: if pdflatex.exe found in PATH use implied path
260where pdflatex.exe 1>NUL 2>NUL
261if errorlevel 1 goto:miktex_continue
262set MIKTEX_ALREADY_ON_PATH=1
263for /f "delims=" %%a in ('where pdflatex.exe') do set R_MIKTEX_PATH=%%~pa
264:: remove trailing \, if any
265IF "%R_MIKTEX_PATH:~-1%"=="\" SET R_MIKTEX_PATH=%R_MIKTEX_PATH:~0,-1%
266
267goto:miktex_end
268
269:miktex_continue
270if not defined R_MIKTEX_PATH for /f "delims=" %%a in (
271 'dir /b /on "%ProgramFiles%"\miktex* 2^>NUL'
272) do set R_MIKTEX_PATH=%ProgramFiles%\%%a\miktex\bin
273
274if not defined R_MIKTEX_PATH for /f "delims=" %%a in (
275 'dir /b /on "%ProgramFiles(x86)%"\miktex* 2^>NUL'
276) do set R_MIKTEX_PATH=%ProgramFiles%\%%a\miktex\bin
277
278if not defined R_MIKTEX_PATH for /f "delims=" %%a in (
279 'dir /b /on %SystemDrive%:\miktex* 2^>NUL'
280) do set R_MIKTEX_PATH=%SystemDrive%:\%%a\mixtex\bin
281
282:miktex_end
283
284:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
285:: MySQL
286:: If MYSQL_HOME defined use that else
287:: check %ProgramFiles%\MySQL\* else
288:: check %SystemDrive%:\MySQL\*
289:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
290
291:: if not defined MYSQL_HOME for /f "delims=" %%a in (
292:: 'dir /b /on "%ProgramFiles%"\MySQL\* 2^>NUL'
293:: ) do set MYSQL_HOME=%ProgramFiles%\MySQL\%%a
294::
295:: if not defined MYSQL_HOME for /f "delims=" %%a in (
296:: 'dir /b /on %SystemDrive%:\MySQL* 2^>NUL'
297:: ) do set R_MIKTEX=%SystemDrive%:\MySQL\%%a
298
299:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
300:: get name by which program was called - $0
301:: or use R_CMD environment variable if that was defined (mainly for testing)
302:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
303
304if not defined R_CMD (set R_CMD=%0)
305for %%i in ("%R_CMD%") do set R_CMD=%%~ni
306if /i "%R_CMD%"=="dir" goto:Rdir
307if /i "%R_CMD%"=="cd" goto:Rcd
308if /i "%R_CMD%"=="touch" goto:Rtouch
309if /i "%R_CMD%"=="Rversions" goto:RSetReg
310
311:: add MiKTeX to PATH if not already on it
312if not defined R_MIKTEX_PATH goto :miktex_add_path_end
313echo %PATH% | findstr /i miktex 1>NUL 2>NUL
314if errorlevel 1 path %R_MIKTEX_PATH%;%PATH%
315:miktex_add_path_end
316
317:: add Rtools paths to PATH if not already on it
318if not defined R_TOOLS_PATH goto :Rtools_add_path_end
319echo %PATH% | findstr /i Rtools 1>NUL 2>NUL
320if errorlevel 1 path %R_TOOLS_PATH%;%PATH%
321:Rtools_add_path_end
322
323if /i "%R_CMD%"=="Rpath" goto:Rpath
324if /i "%R_CMD%"=="Rtools" goto:Rtools
325if /i "%R_CMD%"=="Rcd" goto:Rcd
326if /i "%R_CMD%"=="Rdir" goto:Rdir
327if /i "%R_CMD%"=="Rshow" goto:Rshow
328if /i "%R_CMD%"=="Rtouch" goto:Rtouch
329if /i "%R_CMD%"=="RSetReg" goto:RSetReg
330
331
332if /i not "%R_CMD%"=="Rgui" goto:notRgui
333start "Rgui.exe" "%R_PATH%\Rgui.exe" %args%
334goto:eof
335
336:notRgui
337"%R_PATH%\%R_CMD%.exe" %args%
338
339goto:eof
340
341:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
342:: output the set statements
343:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
344:Rshow
345
346if defined R_PATH (
347 set old=%CD%
348 cd %R_PATH%
349 for /f "delims=" %%a in ("!CD!") do set R_ARCH=%%~nxa
350 cd ..\..
351 set R_HOME=!CD!
352 for /f "delims=" %%a in ("!CD!") do set R_VER=%%~nxa
353 cd ..
354 set R_ROOT=!CD!
355 cd !old!
356)
357
358:: echo set R_PATH=%R_PATH%
359:: echo set R_HOME=%R_HOME%
360:: echo set R_ROOT=%R_ROOT%
361:; echo set R_VER=%R_VER%
362:: echo set R_ARCH=%R_ARCH%
363:: echo set R_TOOLS=%R_TOOLS%
364:: echo set R_TOOLS_PATH=%R_TOOLS_PATH%
365:: :: echo set MYSQL_HOME=%MYSQL_HOME%
366::echo set R_MIKTEX_PATH=%R_MIKTEX_PATH%
367set R
368goto:eof
369
370:Rcd
371endlocal & cd %R_ROOT%
372goto:eof
373
374:Rdir
375dir/od "%R_ROOT%"
376goto:eof
377
378:RSetReg
379cd %R_PATH%
380RSetReg %args%
381goto:eof
382
383:: if not XP then check if running with Admin privs. If not give msg and exit.
384:Rtouch
385ver | findstr XP >NUL
386if not errorlevel 1 goto:Rtouch_next
387if not exist "%ProgramFiles%\R" goto:Rtouch_next
388reg query "HKU\S-1-5-19" >NUL 2>&1 && ( goto Rtouch_next ) || (
389 echo Please run this as Administator.
390 goto :eof
391)
392:Rtouch_next
393
394if not defined R_HOME set R_HOME=%R_ROOT%\%R_VER%
395pushd %R_HOME%
396echo > dummy.txt
397del dummy.txt
398popd
399goto:eof
400
401
402
403:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
404:: set path
405:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
406:Rpath
407endlocal & PATH %PATH%;%R_PATH%
408goto:eof
409
410:Rtools
411endlocal & PATH %PATH%
412goto:eof
413
414:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
415:: list R versions
416:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
417:Rversions
418if defined args goto:Rversions_cont
419pushd %R_HOME%
420cd ..
421echo R packages found. Most recent (last listed) is default:
422for /f "delims=" %%a in ('dir/b /od') do echo %%~fa
423popd
424goto:eof
425:Rversions_cont
426set args=###%args%
427set args=%args:### =%
428set args=%args:###=%
429pushd %R_HOME%
430cd ..
431(for /f "delims=" %%a in ('dir /b /od') do echo %%~fa) | findstr /L /C:"%args%" 1>NUL 2>NUL
432if errorlevel 1 echo %args% not found & goto:eof
433echo Run the following command (may need an elevated cmd window):
434for /f "delims=" %%a in ('dir /b /on ^| findstr /L /C:"%args%"') do @echo echo ^> "%%~fa\dummy.txt" /Y
435popd
436goto:eof
437
438:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
439:: list registry entries
440:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
441
442:Rregistry
443reg query hklm\software\R-core\R /v InstallPath 2>NUL | findstr InstallPath
444reg query hklm\software\wow6432Node\r-core\r /v InstallPath 2>NUL | findstr InstallPath
445
446goto:eof
447
448:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
449::
450:: Extract text from file:
451:: %1 = input string that starts text
452:: %2 = input file
453:: final = output variable holding text from and including %1 until
454:: binary data encountered
455::
456:: Needs: SetLocal EnableExtensions EnableDelayedExpansion
457::
458:: Example:
459:: call :extract_string {app} C:\Rtools\unins000.dat
460:: echo %final%
461:: where {app} is the string that starts extraction and
462:: C:\Rtoolsiunins000.dat is the file
463::
464:: Based on code by Frank Westlake, https://github.com/FrankWestlake
465::
466:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
467
468 :extract_string
469
470 SetLocal EnableExtensions EnableDelayedExpansion
471
472 Set "string=%1"
473 Set "file=%2"
474
475 For /F "delims=" %%a in (
476 'findstr /C:"%string%" "%file%"^|MORE'
477 ) Do (
478 Set "$=%%~a"
479 If /I "!$:~0,5!" EQU "%string%" (
480 Set $=!$:;=" "!
481 For %%b in ("!$!") Do (
482 Set "#=%%~b"
483 If "!#:~0,5!" EQU "%string%" (
484 CALL :work "!#!"
485 )
486 )
487 )
488 )
489 endlocal & set final=%final%
490 Goto :EOF
491 :work
492 set final=%final%!#!;
493 Goto :EOF
494
495 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
496 :trimPath:<variable to trim> [segment to add]
497 :: Eliminates redundant path segments from the variable and
498 :: optionally adds new segmants.
499 :: Example: CALL :trimPath:PATH
500 :: Example: CALL :trimPath:PATH "C:\A & B" C:\a\b\c
501 ::
502 :: Note that only a colon separates the subroutine name and
503 :: the name of the variable to be edited.
504 :: - Frank Westlake, https://github.com/FrankWestlake
505 SetLocal EnableExtensions EnableDelayedExpansion
506 For /F "tokens=2 delims=:" %%a in ("%0") Do (
507 For %%a in (%* !%%a!) Do (
508 Set "#=%%~a"
509 For %%b in (!new!) Do If /I "!#!" EQU "%%~b" Set "#="
510 If DEFINED # (
511 If DEFINED new (Set "new=!new!;!#!") Else ( Set "new=!#!")
512 )
513 )
514 )
515 EndLocal & For /F "tokens=2 delims=:" %%a in ("%0") Do Set "%%a=%new%"
516 Goto :EOF
517
518::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
519
520:Rhelp
521
522echo (c) 2013 G. Grothendieck
523echo License: GPL 2.0 ( http://www.gnu.org/licenses/gpl-2.0.html )
524echo Launch script for R and associated functions.
525echo Usage: R.bat [subcommand] [arguments]
526echo Subcommands where (0) means takes no arguments; (A) means may need Admin priv
527echo cd - cd to R_ROOT, typically to C:\Program Files\R (0)
528echo cmd - Run Rcmd.exe
529echo dir - List contents of R_ROOT in chronological order showing R versions (0)
530echo gui - Run Rgui.exe
531echo help - Help info (0)
532echo path - Add R_TOOLS, R_MIKTEX ^& R_PATH to path for this cmd line session (0)
533echo R - Run R.exe (0)
534echo script - Run Rscript.exe
535echo show - Show R_ variable values used. R_PATH, etc. (0)
536echo SetReg - Run RSetReg; see 2.17 in R FAQ for Windows (A)
537echo tools - Add R_TOOLS and R_MIKTEX to path for this cmd line session (0)
538echo touch - Change date on R_HOME to now (0) (A)
539echo Examples
540echo R -- invoke R.exe R gui -- invoke Rgui.exe
541echo R dir -- show R versions R show -- show R_ variables
542echo R CMD build mypkg -- builds mypkg
543echo cmd /c set R_VER=R-2.14.0 ^& R gui -- run indicated Rgui version
544echo cmd /c set R_ARCH=32 ^^^& R gui -- run 32 bit Rgui
545echo cmd /c R_VER=R-2.14.0 ^^^& R setreg - make 2.14.0 current in registry
546echo cmd /c R_VER=R-2.14.0 ^^^& R.bat touch - change date on R-2.14.0 dir to now
547goto:eof
548echo.
549echo Run Rgui using a different version of R. R_HOME only affects R session
550echo but not cmd line session.
551echo cmd /c set R_HOME=%ProgramFiles%\R\R-2.14.0 ^& R gui
552echo
553echo Launch a new cmd line window in which R_HOME is as set and launch R:
554echo start set R_HOME=%ProgramFiles%\R\R-2.14.0 ^& R gui
555echo
556echo ==Customization by renaming==
557echo.
558echo If the optional first argument is missing then it uses the value of
559echo the environment variable R_CMD or if that is not set it uses the name of
560echo the script file as the default first argument. The idea is one could have
561echo multiple versions of the script called R.bat, Rgui.bat, etc. which invoke
562echo the corresponding functionality without having to specify first argument.
563echo.
564echo ==Customization by setting environment variables at top of script==
565echo.
566echo It can be customized by setting any of R_CMD, R_HOME, R_ARCH,
567echo R_MIKTEX_PATH, R_TOOLS after the @echo off command at the top of the
568echo script. R_CMD will be used as the default first argument (instead of the
569echo script name).
570echo.
571echo e.g. use the following after @echo off to force 32-bit
572echo set R_ARCH=32
573echo.
574echo e.g. use the following after @echo off to force a particular version of
575echo R to be used
576echo set R_HOME=%ProgramFiles%\R\R-2.14.0
577echo.
578echo e.g. use the following after @echo off to change the default command to
579echo Rgui even if the script is called myRgui.bat, say:
580echo set R_CMD=Rgui
581echo.
582echo ==Installation==
583echo.
584echo The script is self contained so just place it anywhere on your Windows
585echo PATH. (From the Windows cmd line the command PATH shows your current
586echo Windows path.) You may optionally make copies of this script with names
587echo like R.bat, Rscript.bat, Rcmd.bat so that each has a different default.
588echo.
589
Note: See TracBrowser for help on using the repository browser.