BATCH= Running Winsteps in batch/script mode = No

1. In standard mode: If you want Winsteps to close itself after performing an analysis and writing out any output specified in the control file, e.g., by TABLES=, then specify BATCH=YES in the control file. You can launch batch files from the Batch menu.

 

If you want to run Winsteps so that it is visible, but automatically closes then:

Winsteps.exe inputfile.txt outputfile.txt

and include the command "batch=yes" in the inputfile.txt

 

2. In Batch/Script mode: If you want Winsteps to run in "background" with the minimum user interaction, then specify BATCH=YES in the Shortcut, DOS or Shell command which invokes Winsteps.

 

If you want to run Winsteps "hidden" then call it from the MS-DOS prompt:

Winsteps.exe batch=yes inputfile.txt outputfile.txt

 

If you want to run many Winsteps analyses consecutively, then use BATCH=Yes. Here is an example using Winsteps to simulate multiple datasets and analyze them.

 

Running Winsteps in Batch mode: If this won't work for you, see Difficulty below.

 

In most versions of Windows, .bat and .cmd function in the same way.

 

Please use whatever works in your version of Windows. First, test what works on your computer:

 

Create a simple text file on your Desktop with Notepad

contents are:

 

START /WAIT NOTEPAD

START /WAIT NOTEPAD

 

Name it "test.bat"

 

Double-click on it. Does Notepad launch? Close Notepad. Does another Notepad launch. If so, all is OK. Use a .bat batch file with START

 

If not, rename "test.bat" to "test.cmd".

Double-click on it. Does Notepad launch? Close Notepad. Does another Notepad launch. If so, all is OK. Use a .cmd batch file with START

 

If not,

rename "test.cmd" to "test.bat"

change the contents of "test.bat" to

 

NOTEPAD

NOTEPAD

 

Double-click on it. Does Notepad launch? Close Notepad. Does another Notepad launch. If so, all is OK. Use a .bat batch file without START.

 

If none of these work for you, then your version of Windows may not support batch files. Please contact www.winsteps.com.

 

Example: Blanks act like new lines in a control file. Commas act like blanks:

START /WAIT ..\Winsteps BATCH=YES SF.txt SF.OUT TFILE=* 1 *  PERSON=CASE IDELETE=3,4,24

 


 

It is often useful to run multiple Winsteps tasks, one after the other, without keyboard intervention. This can be accomplished by running Winsteps in CMD batch mode.

 

i) On the main Winsteps screen, click on the "Batch" menu item.

ii) On the pull-down menu, select "Edit batch file".

iii) In the dialog box, select Winbatchcmd.cmd and click on "Open"

iv) The following batch file is available to edit:

 

echo  This is the version for Windows-NT, 2000

echo  This is a batch file to run Winsteps in batch mode

echo  Edit the next lines and add more.

echo  Format of lines is:

echo  START /WAIT c:\Winsteps\Winsteps BATCH=YES c:\folder\Control-file c:\folder\Output-file Extra=specifications

START /WAIT ..\Winsteps BATCH=YES EXAMPLE0.txt EXAMPLE0.OUT TABLES=111

START /WAIT ..\Winsteps BATCH=YES SF.txt SF.OUT TFILE=* 1 *  PERSON=CASE

START /WAIT ..\Winsteps BATCH=YES KCT.txt KCT.OUT TFILE=* 3 20 * MRANGE=4

 

These characters have special meanings in batch files: @ & ^ ( )

 

v) The lines starting with "echo" are comments.

v) Lines starting "START /WAIT c:\Winsteps\Winsteps BATCH=YES" execute Winsteps from the Winsteps folder

vi) The format is START /WAIT Winsteps BATCH=YES control-file output-file extra-specifications

vii) Each new Winsteps line is an additional run of the Winsteps program

viii) Edit and save this file. You can save it with any name ending ".cmd"

 

ix) From the "Batch" pull-down menu, select "Run batch file".

x) Right-click on the desired batch file

xi) In the right-click menu, left-click on "open"

x) The batch file will run - if nothing happens, the batch file is incorrect.

xi) Exit from the Winsteps dialog by clicking on "Cancel".

xii) You can minimize the batch screen by clicking on the underline in the top right corner.

xiii) You can cancel the batch run by right clicking on the Batch icon in the Task bar, usually at the bottom of the screen.

 

Example: I want to automatically run multiple DIF reports for the same set of data.

Since Winsteps can only perform one DIF analysis at a time in batch mode, you can use anchor files:

First line in batch file, produce measure files

Winsteps BATCH=YES infile outfile dif=$s1w1 ifile=ifile.txt pfile=pfile.txt sfile=sfile.txt

Later lines in batch file, use measure files as anchor files

Winsteps BATCH=YES infile outfile2 dif=$s2w1 ifile=iafile.txt pfile=pafile.txt safile=sfile.txt tfile=* 30 *

Winsteps BATCH=YES infile outfile3 dif=$s3w1 ifile=iafile.txt pfile=pafile.txt safile=sfile.txt tfile=* 30 *

 


A Winsteps batch processor for Windows

 

Batch files under Windows are used to test out new features in Winsteps. Here is what is done:

 

a) Create a new subfolder of c:\Winsteps, called c:\Winsteps\test

 

b) Copy into folder "test" all the control and data files to be analyzed. For instance all the Winsteps example control and data files, which are found in c:\Winsteps\examples

 

c) Use Notepad to create a file in c:\Winsteps\test to do the analysis. This file is "saved as" test.bat

This file contains, for instance:

 

start /w c:\Winsteps\Winsteps batch=yes exam1.txt exam1.out DISC=YES TABLES=111

start /w c:\Winsteps\Winsteps batch=yes exam9.txt exam9.out DISC=YES TABLES=111

start /w c:\Winsteps\Winsteps batch=yes sf.txt sf.out DISC=YES TABLES=111

 

You can replace ..\Winsteps with the pathname to your copy of Winsteps.exe

d) double-click on test.bat in c:\Winsteps\test to run this batch file.

e) Winsteps "flashes" on the task bar several times, and progress through the batch file is shown in a DOS-style window.

e) the .out files are written into c:\Winsteps\test

 

Example 1. Windows file: test.cmd to do 10 analyses from the same control and data files

 

rem - change the directory to the control and data files

chdir c:\Winsteps\examples

chdir

echo check that the change directory worked

pause

START /Wait c:\Winsteps\Winsteps.exe exam1.txt SCReadDIFg2.out.txt pselect=$2* Title=READING_DIF_grade_2

echo check that Winsteps was called as expected: add BATCH=Y to the line above when it works correctly

pause

START /Wait c:\Winsteps\Winsteps.exe BATCH=Y exam1.txt exam1g3.out.txt pselect=$3* Title=READING_DIF_grade_3

START /Wait c:\Winsteps\Winsteps.exe BATCH=Y exam1.txt exam1g4.out.txt pselect=$4* Title=READING_DIF_grade_4

START /Wait c:\Winsteps\Winsteps.exe BATCH=Y exam1.txt exam1g5.out.txt pselect=$5* Title=READING_DIF_grade_5

START /Wait c:\Winsteps\Winsteps.exe BATCH=Y exam1.txt exam1g6.out.txt pselect=$6* Title=READING_DIF_grade_6

START /Wait c:\Winsteps\Winsteps.exe BATCH=Y exam1.txt exam1g7.out.txt pselect=$7* Title=READING_DIF_grade_7

START /Wait c:\Winsteps\Winsteps.exe BATCH=Y exam1.txt exam1g8.out.txt pselect=$8* Title=READING_DIF_grade_8

START /Wait c:\Winsteps\Winsteps.exe BATCH=Y exam1.txt exam1g10.out.txt pselect=$10* Title=READING_DIF_grade_10

START /Wait c:\Winsteps\Winsteps.exe BATCH=Y exam2.txt exam2g2.out.txt pselect=$2* Title=MATH_DIF_grade_2

START /Wait c:\Winsteps\Winsteps.exe BATCH=Y exam2.txt exam2g3.out.txt pselect=$3* Title=MATH_DIF_grade_3

START /Wait c:\Winsteps\Winsteps.exe BATCH=Y exam2.txt exam2g4.out.txt pselect=$4* Title=MATH_DIF_grade_4

START /Wait c:\Winsteps\Winsteps.exe BATCH=Y exam2.txt exam2g5.out.txt pselect=$5* Title=MATH_DIF_grade_5

START /Wait c:\Winsteps\Winsteps.exe BATCH=Y exam2.txt exam2g6.out.txt pselect=$6* Title=MATH_DIF_grade_6

START /Wait c:\Winsteps\Winsteps.exe BATCH=Y exam2.txt exam2g7.out.txt pselect=$7* Title=MATH_DIF_grade_7

START /Wait c:\Winsteps\Winsteps.exe BATCH=Y exam2.txt exam2g8.out.txt pselect=$8* Title=MATH_DIF_grade_8

START /Wait c:\Winsteps\Winsteps.exe BATCH=Y exam2.txt exam2g10.out.txt pselect=$10* Title=MATH_DIF_grade_10

 

If you want to combine all the output files into one file:

copy /Y *.out.txt all.txt

 

Example 2. To estimate the expected values of the eigenvalues in Table 23.0 by simulation

Your files are in folder: D:\rasch_simulation
Winsteps.exe is in folder C:\Winsteps
The output is Table 23.0
The batch file is:
 
D:
MKDIR \rasch_simulation
CD \rasch_simulation
REM
START /WAIT C:\Winsteps\winsteps.exe BATCH=YES marlon0.txt marlon0.out.txt PFILE=pf.txt IFILE=if.txt SFILE=sf.txt
REM
set /a test=1
:loop
REM
START /WAIT C:\Winsteps\winsteps.exe BATCH=YES marlon0.txt marlon0%loop%.out.txt PAFILE=pf.txt IAFILE=if.txt SAFILE=sf.txt SIFILE=SIFILE%test%.txt SISEED=0
REM
START /WAIT C:\Winsteps\winsteps.exe BATCH=YES marlon0.txt data=SIFILE%test%.txt SIFILE%test%.out.txt TFILE=* 23.0 *
REM
set /a test=%test%+1
if not "%test%"=="11" goto loop
PAUSE

 


 

Performing multiple simulations in Batch mode

1. Use NotePad to create a text file called "Simulate.bat"

2. In this file:

 

REM - produce the generating values: this example uses example0.txt:

START /WAIT c:\Winsteps\Winsteps.exe BATCH=YES  example0.txt example0.out.txt PFILE=pf.txt IFILE=if.txt SFILE=sf.txt

 

REM - simulate 101 datasets - use anchor values to speed up processing

START /WAIT c:\Winsteps\Winsteps.exe  BATCH=YES example0.txt example0%test%.out.txt PAFILE=pf.txt IAFILE=if.txt SAFILE=sf.txt SIFILE=SIFILE.txt SISEED=0 SINUMBER=101

 

REM - initialize the loop counter: go from 2 to 101 for numbered SIFILE2.txt to SIFILE101.txt

set /a test=2

:loop

 

REM - estimate from the simulated dataset

START /WAIT c:\Winsteps\Winsteps.exe BATCH=YES example0.txt data=SIFILE%test%.txt SIFILE%test%.out.txt pfile=pf%test%.txt ifile=if%test%.txt sfile=sf%test%.txt TFILE=* 3.1 *

REM - do 100 times

set /a test=%test%+1

if not "%test%"=="102" goto loop

PAUSE

 

3. Save "Simulate.bat", then double-click on it to launch it.

4. The simulate files and their estimates are numbered 1 to 100.

 

5. The files of estimates can be combined and sorted using MS-DOS commands, e.g.,

Copy  SIFILE*.out.txt combined.txt

 

Rem Sort brings similar lines together

Sort /+(sort column) <combined.txt  >sorted.txt

 

Rem Find extracts lines with specific words

Find "CRONBACH ALPHA" <combined.txt  >found.txt

 

6. Individual lines from the output files can be written to one file using MS-DOS batch commands. For instance, using an MS-DOS batch routine (.bat or .cmd), the same text line can be extracted from many text files and output into a new text file. The new text file can be be pasted into Excel. Save these MS-DOS commands as extract.bat in the folder that has the files of statistics. Double click on extract.bat to execute it.

 

rem replace 2 with the number of lines to skip before the line you want

@echo off

setlocal EnableDelayedExpansion

if exist result.csv del result.csv

for %%f in (*.txt) do (

 echo %%f

 set i=a

 for /F "skip=2 delims=" %%l in (%%f) do (

   if "!i!" == "a" echo %%f, %%l >> result.csv

   set i=b

 )

)

notepad result.csv

Example: to verify degrees of freedom for global statistics in Table 44:

 

REM - produce the generating values: this example uses example0.txt:

START /WAIT c:\Winsteps\Winsteps.exe BATCH=YES  example0.txt example0.out.txt PFILE=pf.txt IFILE=if.txt SFILE=sf.txt tfile=* 44 *

 

REM - initialize the loop counter

set /a test=1

:loop

 

REM - simulate a dataset - use anchor values to speed up processing (or use SINUMBER= to avoid this step)

START /WAIT c:\Winsteps\Winsteps.exe  BATCH=YES example0.txt example0%test%.out.txt PAFILE=pf.txt IAFILE=if.txt SAFILE=sf.txt SIFILE=SIFILE%test%.txt SISEED=0

 

REM - estimate from the simulated dataset

START /WAIT c:\Winsteps\Winsteps.exe BATCH=YES example0.txt data=SIFILE%test%.txt SIFILE%test%.out.txt pfile=pf%test%.txt ifile=if%test%.txt sfile=sf%test%.txt TFILE=* 44 *

REM - do 100 times

set /a test=%test%+1

if not "%test%"=="101" goto loop

PAUSE

REM combine all the output files

Copy SIFILE*.out.txt combinedif.txt

REM sort the output files together

Sort /+1 <combinedif.txt  >sortedif.txt

REM copy-and-paste the Log-Likelihood lines into Excel to average them and compare with d.f. in the original Table 44.

 


 

Difficulty running Batch or Command files?

Microsoft Windows is designed to run interactively, not in batch mode. Microsoft are not consistent with the way they implement batch files in different versions of Windows. So our challenge is to discover a method of running batch files that works for the version of Windows we happen to have. Since Windows is very bad at running batch or command files. You need to validate your instructions one step at a time:

 

First make sure that your batch file runs without "BATCH=YES" so that you can see Winsteps in operation.

 

Paths with blanks? Put in quotes:

START /WAIT "e:\my folder\Winsteps folder\Winsteps.exe" BATCH=YES ....

 

i) Run Winsteps in standard mode from the DOS command prompt.

 

ii) Have the full paths to everything in your batch or command file, e.g., called mybatch.cmd,

START /WAIT c:\Winsteps\Winsteps BATCH=YES c:\Winsteps\examples\example0.txt c:\Winsteps\examples\example0.out.txt
also have full paths to everything in your Winsteps control file, e.g.,

DATA = c:\Winsteps\examples\mydata.txt

 

Note: In this Batch command:

START /WAIT c:\Winsteps\Winsteps BATCH=YES c:\Winsteps\examples\controlfile.txt outputfile.txt
file "outputfile.txt" will be placed in directory "c:\Winsteps\examples\"

 

iii) Windows "Start" menu. "Run". Copy and paste the following line into the Windows Run box on the Windows Start menu. Click OK:

c:\Winsteps\Winsteps c:\Winsteps\examples\example0.txt c:\Winsteps\examples\example0.out.txt table=1

 

Does Winsteps start in the ordinary way? This tests the Windows command line interface.

 

iv) Windows "Start" menu. "Run". Copy and paste the following line into the Run box. Click OK:

c:\Winsteps\Winsteps BATCH=YES c:\Winsteps\examples\exam15.txt c:\Winsteps\examples\exam15.out.txt table=1

 

Does the Winsteps icon appear on the Task bar and then disappear? This tests Winsteps background processing.

 

v) On your desktop, right-click, "New", "Text document". Double-click on icon. Paste in:

START /WAIT c:\Winsteps\Winsteps c:\Winsteps\examples\example0.txt c:\Winsteps\examples\example0.out.txt table=1

 

"Save as" Test.cmd. Double-click on Test.cmd

 

Does Winsteps run in the ordinary way? This test the Windows START function. If this fails, "Save as" Test.bat instead of Test.cmd.

 

vi) On your desktop, right-click, "New", "Text document". Double-click on icon. Paste in:

START /WAIT c:\Winsteps\Winsteps BATCH=YES c:\Winsteps\examples\exam15.txt c:\Winsteps\examples\exam15.out.txt table=1

 

"Save as" Test2.cmd. Double-click on Test2.cmd (or "Save as" Test2.bat if that works better on your computer.)

 

Does the Winsteps icon flash on the task bar line, and then disappear? Winsteps has run in background.

 

vii) Now build your own .cmd batch file, using lines like:

START /WAIT c:\Winsteps\Winsteps BATCH=YES c:\Winsteps\examples\example0.txt c:\Winsteps\examples\example0.out.txt

 

viii) If your command line contains sub-lists, indicate those with commas, e.g.,

IWEIGHT=* 23,2.5 47,1.3 *

 


 

Running Winsteps within other Software

Automating the standard version of Winsteps is straightforward using the control instruction BATCH=YES. Winsteps will run under Windows in background.

 

Let's assume your software is written in Visual Basic (or any other programming, database or statistical language)

 

(a) write out a Winsteps control file as a .txt file

(b) write out a Winsteps data file as a .txt file

(c) "shell" out to

"START /WAIT Winsteps BATCH=YES controlfile.txt outputfile.txt data=datafile.txt ifile=ifile.txt pfile=pfile.txt"

 

(d) read in the ifile.txt, pfile.txt or whatever Winsteps output you need to process.

 

This is being done routinely by users of SAS.

 


 

Running Winsteps within R

 

Use the R "system" command. To test that Winsteps runs correctly, specify:

 

try(system("c:/Winsteps/Winsteps.exe BATCH=NO yourcontrolfile youroutputfile", intern = TRUE, ignore.stderr = TRUE))

 

or, if the file names contain spaces, then use single quotes and double quotes:

 

try(system('c:/Winsteps/Winsteps.exe BATCH=NO "your control file" "your output file" ', intern = TRUE, ignore.stderr = TRUE))

 

For regular use:

 

try(system("START /WAIT c:/Winsteps/Winsteps.exe BATCH=YES yourcontrolfile youroutputfile", intern = TRUE, ignore.stderr = TRUE))

 

or

 

try(system('START /WAIT c:/Winsteps/Winsteps.exe BATCH=YES  "your control file" "your output file" ', intern = TRUE, ignore.stderr = TRUE))

 

or

 

shell("c:/Winsteps/winsteps.exe control.txt output.txt")

this automatically waits for Winsteps to complete before returning to an R prompt

 

See also r2Winsteps


Help for Winsteps Rasch Measurement and Rasch Analysis Software: www.winsteps.com. Author: John Michael Linacre

Facets Rasch measurement software. Buy for $149. & site licenses. Freeware student/evaluation Minifac download
Winsteps Rasch measurement software. Buy for $149. & site licenses. Freeware student/evaluation Ministep download

Rasch Books and Publications
Invariant Measurement: Using Rasch Models in the Social, Behavioral, and Health Sciences, 2nd Edn, 2024 George Engelhard, Jr. & Jue Wang Applying the Rasch Model (Winsteps, Facets) 4th Ed., Bond, Yan, Heene Advances in Rasch Analyses in the Human Sciences (Winsteps, Facets) 1st Ed., Boone, Staver Advances in Applications of Rasch Measurement in Science Education, X. Liu & W. J. Boone Rasch Analysis in the Human Sciences (Winsteps) Boone, Staver, Yale
Introduction to Many-Facet Rasch Measurement (Facets), Thomas Eckes Statistical Analyses for Language Testers (Facets), Rita Green Invariant Measurement with Raters and Rating Scales: Rasch Models for Rater-Mediated Assessments (Facets), George Engelhard, Jr. & Stefanie Wind Aplicação do Modelo de Rasch (Português), de Bond, Trevor G., Fox, Christine M Appliquer le modèle de Rasch: Défis et pistes de solution (Winsteps) E. Dionne, S. Béland
Exploring Rating Scale Functioning for Survey Research (R, Facets), Stefanie Wind Rasch Measurement: Applications, Khine Winsteps Tutorials - free
Facets Tutorials - free
Many-Facet Rasch Measurement (Facets) - free, J.M. Linacre Fairness, Justice and Language Assessment (Winsteps, Facets), McNamara, Knoch, Fan
Other Rasch-Related Resources: Rasch Measurement YouTube Channel
Rasch Measurement Transactions & Rasch Measurement research papers - free An Introduction to the Rasch Model with Examples in R (eRm, etc.), Debelak, Strobl, Zeigenfuse Rasch Measurement Theory Analysis in R, Wind, Hua Applying the Rasch Model in Social Sciences Using R, Lamprianou El modelo métrico de Rasch: Fundamentación, implementación e interpretación de la medida en ciencias sociales (Spanish Edition), Manuel González-Montesinos M.
Rasch Models: Foundations, Recent Developments, and Applications, Fischer & Molenaar Probabilistic Models for Some Intelligence and Attainment Tests, Georg Rasch Rasch Models for Measurement, David Andrich Constructing Measures, Mark Wilson Best Test Design - free, Wright & Stone
Rating Scale Analysis - free, Wright & Masters
Virtual Standard Setting: Setting Cut Scores, Charalambos Kollias Diseño de Mejores Pruebas - free, Spanish Best Test Design A Course in Rasch Measurement Theory, Andrich, Marais Rasch Models in Health, Christensen, Kreiner, Mesba Multivariate and Mixture Distribution Rasch Models, von Davier, Carstensen
As an Amazon Associate I earn from qualifying purchases. This does not change what you pay.

facebook Forum: Rasch Measurement Forum to discuss any Rasch-related topic

To receive News Emails about Winsteps and Facets by subscribing to the Winsteps.com email list,
enter your email address here:

I want to Subscribe: & click below
I want to Unsubscribe: & click below

Please set your SPAM filter to accept emails from Winsteps.com
The Winsteps.com email list is only used to email information about Winsteps, Facets and associated Rasch Measurement activities. Your email address is not shared with third-parties. Every email sent from the list includes the option to unsubscribe.

Questions, Suggestions? Want to update Winsteps or Facets? Please email Mike Linacre, author of Winsteps mike@winsteps.com


State-of-the-art : single-user and site licenses : free student/evaluation versions : download immediately : instructional PDFs : user forum : assistance by email : bugs fixed fast : free update eligibility : backwards compatible : money back if not satisfied
 
Rasch, Winsteps, Facets online Tutorials


 

 

 

Our current URL is www.winsteps.com

Winsteps® is a registered trademark