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:
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:
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
Later lines in batch file, use measure files as anchor files
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:
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
If you want to combine all the output files into one file:
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
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 |
---|
Forum: | Rasch Measurement Forum to discuss any Rasch-related topic |
---|
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