rem LEACHEBAT.BAT

ECHO OFF

rem   THIS IS THE BATCH FILE CALLED FROM THE 'SAVE AND RUN' MACRO
rem   IN THE EXCEL VERSION OF THE LEACHM PESTICIDE DATA FILE
rem  ------------------------------------------------------------
rem If LEACHEBAT.BAT is not in the same folder as the data file,
rem then create a PATH to its location.

if %3 == 1 copy %1.csv %1
if %3 == 2 copy %1.prn %1
if %3 == 3 copy %1.txt %1

rem  Erase existing output files which may have the same name
rem  This is done in case a subsequent run specified fewer output
rem  files than the previous run.

erase %1.out
erase %1.sum
erase %1.irr
erase %1.btc
erase %1.grd

rem  Execute LEACHM using the default path to the LEACHE.EXE file.
rem  Edit the path defined here to reflect the current LEACHEP.EXE
rem  location.

leachE<%1

rem Erase the duplicate input data file that does not have an
rem extension (optional).

erase %1
rem erase Soilprops8.prn

rem The 'pause' here prevents the Command Window from closing
rem immediately after LEACHE has run. Provides an opportunity
rem to examine error messages etc.

pause