This page was created as a vehicle for showing how statistical and mathematical software can be used from the command line in Windows. This means we can also put the command line into a batch file and then run it from Windows Explorer. It is therefore especially useful for blind users who rely on screen reader software to have access to printed text and often cannot use this software interactively. Most of the experiences listed here are my own, but I am grateful to other people (both blind and sighted) who have shared their experiences with me over the years.
Please contact Jonathan Godfrey if you wish to ask questions about software not listed here that I might know something about or for more detail than is given here. Sharing your personal experiences with me might also help improve this page.
Software is listed in alphabetical order and currently includes:
I plan to fill in the section for Matlab at some stage. I don’t have all software listed here on all of my computers so must wait until I get time at work.
For each of the software applications I have tested, I start by specifying the version of the software used and the date I last checked things were working. This has proven important as some software changes the folder in which it is installed. This will have particular importance for the command line you will use.
Three subsections are then given:
Input.txt
unless stated otherwise. Put that into a plain text file and save it with the filename that matches the command line.Output.txt
unless stated otherwise.The text of these subsections is separated by headings so you can be sure where the files start and stop.
Any additional notes that might help are in a final subsection.
I’ve presented the full command line here because I don’t edit my system’s path variable unless software does it as part of its installation. I know I could, but I prefer to use more advanced methods in my own work that are not appropriate for sharing here. If you do choose to edit your path, then the full path to the executable in the command lines is not required.
Version 10 was tested on 20 September 2016. My thanks to Theodor Loots (University of Pretoria) who provided most of the content for this example.
"C:\Program Files\Wolfram Research\Mathematica\10.0\math.exe" -script Input.txt
MyFile = OpenWrite["output.tex"]
OutputFile = OpenWrite["log.txt"]
$Messages = {OutputFile}
SetOptions[MyFile, FormatType -> OutputForm]; SetOptions[OutputFile, FormatType -> InputForm];
F[x] := x^2+1;
Write[MyFile, TeXForm[F[x]]];
Sol = Integrate[F[x], x]
Write[MyFile, TeXForm[Sol]];
Quit[]
The integral of $x^2+1$ is
$$\frac{x^3}{3}+x$$
The file log.txt
was also generated but is blank for this example input file.
c:\prog
blah
blah
Version 5.25.0 tested on 16 September 2016
"C:\Program Files\Maxima-5.25.0\bin\maxima.bat" -q --userdir="." < "Input.txt" > Output.txt
display2d:false;
diff(2*x+3,x,1);
diff(t1*exp(-t2*exp(-t3*x)),x,1);
tex(%o3);
solve(a*x^2+b*x+c=0,x);
tex(solve(a*x^2+b*x+c=0,x));
(%i1)
(%o1) false
(%i2)
(%o2) 2
(%i3)
(%o3) t1*t2*t3*%e^(-t2*%e^-(t3*x)-t3*x)
(%i4) $${\it t_1}\,{\it t_2}\,{\it t_3}\,e^{-{\it t_2}\,e^ {- {\it t_3}\,x
}-{\it t_3}\,x}\leqno{\tt (\%o3)}$$
(%o4) "(\\%o3)"
(%i5)
(%o5) [x = -(sqrt(b^2-4*a*c)+b)/(2*a),x = (sqrt(b^2-4*a*c)-b)/(2*a)]
$$\left[ x=-{{\sqrt{b^2-4\,a\,c}+b}\over{2\,a}} , x={{\sqrt{b^2-4\,a
\,c}-b}\over{2\,a}} \right] $$
(%o6) false
(%i7)
The first line of the Input.txt
file helps display content in a more readable form. This is more useful for interactive use of wxMaxima than the batch processing mode of operation.
Minitab 17 was tested in October 2016 and was a complete failure. See the notes section below for more detail, but this software is not recommended for use in batch mode at the time of writing, nor is it recommended for use by blind people in an interactive mode.
"C:\Program Files\Minitab\Minitab 17\mtb.exe" "E:\Input.mtb"
Version 4.0.0 tested on 16 September 2016
"C:\Octave\Octave-4.0.0\bin\octave-cli" -q Input.m
diary Output.txt
Mat=[5,2;-1,5]
RHS=[16, 13]'
Sol=Mat\RHS
diary off
Mat =
5 2
-1 5
RHS =
16
13
Sol =
2.0000
3.0000
Version 3.6.1 tested on 18 September 2019
C:\PROGRA~1\R\R-36~1.1\bin\R.exe CMD BATCH --vanilla --quiet Input.R
MySample=sample(40,10)
MySample
mean(MySample)
> MySample=sample(40,10)
> MySample
[1] 30 15 14 4 21 19 12 2 20 29
> mean(MySample)
[1] 16.6
>
> proc.time()
user system elapsed
0.15 0.04 0.34
vanilla
and quiet
options help by ensuring a blank workspace and minimises the output by suppressing the welcome messages respectively.Input.R
here for reasons of consistency only. I usually use much more informative filenames for my R scripts.BrailleR
package, then you will be able to create the necessary batch file with the right command line using the MakeBatch()
command. For example, if you have the input file Input.R
then you can issue the command MakeBatch("Input.R")
and this will create a new batch file for you called Input.bat
.Version 9.4 was tested using a laboratory computer on 22 September 2016. The Input file was saved on a memory stick, so the command line was run from the folder on the memory stick, not on a hard drive folder.
"C:\Program Files\SASHome\SASFoundation\9.4\SAS.exe" -sysin "Input.sas" -nosplash -icon -log "log.txt" -print "Output.txt"
%let MyPath = .;
ods graphics on/imagename="OurGraph";
proc import datafile="&MyPath.\DataFile.csv"
out=OurData
dbms=csv
replace;
getnames=yes;
run;
proc univariate data=OurData; run;
proc reg data=OurData simple
outest=OurModel(keep=Intercept X)
plots(only stats=none)=(FitPlot(nolimits));
model y = x;
run;
quit;
1 The SAS System 11:04 Thursday, September 22, 2016
NOTE: Copyright (c) 2002-2012 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1M2)
Licensed to MASSEY UNIVERSITY - EAS, Site 10004572.
NOTE: This session is executing on the X64_7PRO platform.
NOTE: Updated analytical products:
SAS/STAT 13.2
SAS/ETS 13.2
SAS/OR 13.2
SAS/IML 13.2
SAS/QC 13.2
NOTE: Additional host information:
X64_7PRO WIN 6.1.7601 Service Pack 1 Workstation
NOTE: SAS initialization used:
real time 0.27 seconds
cpu time 0.18 seconds
1 %let MyPath = .;
2
3 ods graphics on/imagename="OurGraph";
4
5 proc import datafile="&MyPath.\DataFile.csv"
6 out=OurData
7 dbms=csv
8 replace;
9 getnames=yes;
10 run;
11 /**********************************************************************
12 * PRODUCT: SAS
13 * VERSION: 9.4
14 * CREATOR: External File Interface
15 * DATE: 22SEP16
16 * DESC: Generated SAS Datastep Code
17 * TEMPLATE SOURCE: (None Specified.)
18 ***********************************************************************/
19 data WORK.OURDATA ;
20 %let _EFIERR_ = 0; /* set the ERROR detection macro variable */
21 infile '.\DataFile.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ;
22 informat x best32. ;
23 informat y best32. ;
24 format x best12. ;
25 format y best12. ;
26 input
27 x
2 The SAS System 11:04 Thursday, September 22, 2016
28 y
29 ;
30 if _ERROR_ then call symputx('_EFIERR_',1); /* set ERROR detection macro
30 ! variable */
31 run;
NOTE: The infile '.\DataFile.csv' is:
Filename=E:\SAS\DataFile.csv,
RECFM=V,LRECL=32767,File Size (bytes)=1274,
Last Modified=28 November 2013 21:16:46,
Create Time=22 September 2016 09:38:31
NOTE: 100 records were read from the infile '.\DataFile.csv'.
The minimum record length was 7.
The maximum record length was 12.
NOTE: The data set WORK.OURDATA has 100 observations and 2 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
100 rows created in WORK.OURDATA from .\DataFile.csv.
NOTE: WORK.OURDATA data set was successfully created.
NOTE: The data set WORK.OURDATA has 100 observations and 2 variables.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.05 seconds
cpu time 0.04 seconds
32
33 proc univariate data=OurData; run;
NOTE: The PROCEDURE UNIVARIATE printed pages 1-4.
NOTE: PROCEDURE UNIVARIATE used (Total process time):
real time 0.04 seconds
cpu time 0.03 seconds
34
35 proc reg data=OurData simple
36 outest=OurModel(keep=Intercept X)
37 plots(only stats=none)=(FitPlot(nolimits));
38 model y = x;
39 run;
40 quit;
NOTE: The data set WORK.OURMODEL has 1 observations and 2 variables.
3 The SAS System 11:04 Thursday, September 22, 2016
NOTE: The PROCEDURE REG printed pages 5-6.
NOTE: PROCEDURE REG used (Total process time):
real time 2.72 seconds
cpu time 0.71 seconds
NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
real time 3.17 seconds
cpu time 1.01 seconds
Output.txt
file was seven pages in length, but that’s what SAS does.OurGraph.png
I’m currently finding this is more difficult than any other software tested.
Version 14 was tested on 20 September 2016.
"C:\Program Files\Stata14\StataMP" /e do Input.do
log using "Output.txt", text replace
import delimited "DataFile.csv", delimiter(comma)
describe
summarize
scatter y x
graph export "scatterplot.pdf", as(pdf) replace
graph export "scatterplot.eps", as(eps) replace
log close
-------------------------------------------------------------------------------
name: <unnamed>
log: C:\...\Output.txt
log type: text
opened on: 20 Sep 2016, 15:53:32
. import delimited "DataFile.csv", delimiter(comma)
(2 vars, 100 obs)
. describe
Contains data
obs: 100
vars: 2
size: 800
-------------------------------------------------------------------------------
storage display value
variable name type format label variable label
-------------------------------------------------------------------------------
x float %9.0g
y float %9.0g
-------------------------------------------------------------------------------
Sorted by:
Note: Dataset has changed since last saved.
. summarize
Variable | Obs Mean Std. Dev. Min Max
-------------+---------------------------------------------------------
x | 100 51.1309 28.73384 .4 99.43
y | 100 55.5697 27.15721 5.07 112.97
. scatter y x
. graph export "scatterplot.pdf", as(pdf) replace
(file scatterplot.pdf written in PDF format)
. graph export "scatterplot.eps", as(eps) replace
(file scatterplot.eps written in EPS format)
. log close
name: <unnamed>
log: C:\...\Output.txt
log type: text
closed on: 20 Sep 2016, 15:53:32
-------------------------------------------------------------------------------
The batch processing of Input.do
automatically generates the corresponding Input.log
, but I have also forced a specified log file within the script called Output.txt
. The files are identical except for the printing of the Stata header information and a few blank lines. Use hte log file once; I’m sure you’ll prefer the output file approach instead.
The use of replace
in the script for commands including a file throws a warning if you do not already have these files to overwrite. I made sure these warnings do not appear here. Don’t panic if you see them when you test this workflow.
I edited the path to the output file that appears in the output content given here. The full path to the actual location of this file on my hard drive is not going to help you.