BATCH= Running Winsteps in batch mode = No |
Top Up Down
A A |
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 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:
Winsteps.exe batch=yes inputfile.txt outputfile.txt
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
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.
Under Windows-2000, -XP and later Windows-NT
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.
Under early versions of Windows (e.g. 98, ME) except early Windows-NT nor -9 nor 3.1
It is often useful to run multiple WINSTEPS tasks, one after the other, without keyboard intervention. This can be accomplished by running WINSTEPS in 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 Winbatchbat.bat and click on "Open"
iv) The following batch file is available to edit:
echo This is the version for WINDOWS-98 and ME
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 /w c:\winsteps\WINSTEPS BATCH=YES c:\folder\Control-file c:\folder\Output-file Extra=specifications
START /w ..\WINSTEPS BATCH=YES EXAMPLE0.txt EXAMPLE0.OUT.txt TABLES=111
START /w ..\WINSTEPS BATCH=YES SF.txt SF.OUT.txt TFILE=* 1 * PERSON=CASE
START /w ..\WINSTEPS BATCH=YES KCT.txt KCT.OUT.txt 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 /w WINSTEPS BATCH=YES" execute WINSTEPS
vi) The format is START /w 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 ".bat"
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.
Under early Windows-NT
It is often useful to run multiple WINSTEPS tasks, one after the other, without keyboard intervention. This can be accomplished by running WINSTEPS in 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 NTbatch.bat and click on "Open"
iv) The following batch file is available to edit:
echo This is for early versions of WINDOWS-NT
echo For later versions use *.cmd files
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 c:\winsteps\WINSTEPS BATCH=YES c:\folder\Control-file c:\folder\Output-file Extra=specifications
..\WINSTEPS BATCH=YES EXAMPLE0.txt EXAMPLE0.OUT.txt Tables=111
..\WINSTEPS BATCH=YES SF.txt SF.OUT.txt TFILE=* 1 * PERSON=CASE
..\WINSTEPS BATCH=YES KCT.txt KCT.OUT.txt TFILE=* 3 20 * MRANGE=4
These characters have special meanings in batch files: @ & ^ ( )
v) The lines starting with "echo" are comments.
v) Lines starting "WINSTEPS BATCH=YES" execute WINSTEPS
vi) The format is 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 ".bat"
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 Windows-XP batch processor
Batch files under Windows XP 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 XP file: test.cmd
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
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 (as much as Windows permits).
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
"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))
then for regular use:
try(system("c:/Winsteps/Winsteps.exe BATCH=YES yourcontrolfile youroutputfile", intern = TRUE, ignore.stderr = TRUE))