Run TUFLOW From a Batch-file: Difference between revisions
Content deleted Content added
Line 99:
The advantage of using variables is if the path to the TUFLOW exe changes, or to run a different version of TUFLOW, it is just a simple change in the .bat file. In the above, note the use of quotes around %TUFLOWEXE% in the definition for the RUN variable – quotes are needed around file pathnames whenever they contain a space.
===Looping in a batch file===
If you have a large number of events to run using the event files a for loop can be used in a batch file. In this example we have 5 event magnitudes (-e1 input) and 5 event durations (-e2 input). The following batch file can be used to run all 25 simulations one after the other:
<pre>
@echo off
SetLocal
set B=Q010 Q020 Q050 Q100 Q200
set A=10min 30min 60min 120min 270min
FOR %%b in (%B%) do (
FOR %%a in (%A% %%b) DO (
IF NOT %%b==%%a start "TUFLOW" /wait C:\TUFLOW\releases\2011-09\w64\TUFLOW_iSP_w64.exe -e1 %%b -e2 %%a filename.tcf
)
)
</pre>
In order to test the syntax, you can test the batch file by replacing the following line:<br>
<tt>IF NOT %%b==%%a start "TUFLOW" /wait C:\TUFLOW\releases\2011-09\w64\TUFLOW_iSP_w64.exe -e1 %%b -e2 %%a filename.tcf</tt><br>
With the following line:<br>
<tt>IF NOT %%b==%%a echo start "TUFLOW" /wait C:\TUFLOW\releases\2011-09\w64\TUFLOW_iSP_w64.exe -e1 %%b -e2 %%a filename.tcf</tt><br>
By using the echo in the command line, rather than starting the simulations the command line will be displayed in the DOS output. In the example above the DOS output is shown in the image below.
[[File:DOS nested batch output.png|frame|none]]
| |||