Reputation: 27
i dont get it. I would like to pass multiple parameters to a batch file, that has the following description:
When passing parameters instead the first parameter (%1) should be PARAM and the
other parameters are shown in the list.
%epin% or %1 contains the file with full path and no extensions for input files
%epout% or %2 contains the file with full path and no extensions for output files
%epinext% or %3 contains the extension of the file selected from the EP-Launch
program. Could be imf or idf -- having this parameter ensures that the correct user
selected file will be used in the run.
%epwthr% or %4 contains the file with full path and extension for the weather file
%eptype% or %5 contains either "EP" or "NONE" to indicate if a weather file is used
%pausing% or %6 contains Y if pause should occur between major portions of
batch file
%maxcol% or %7 contains "250" if limited to 250 columns otherwise contains
"nolimit" if unlimited (used when calling readVarsESO)
%convESO% or %8 contains Y if convertESOMTR program should be called
%procCSV% or %9 contains Y if csvProc program should be called
%cntActv% or %10 contains the count of other simulations active or about to be
active
%multithrd% or %11 contains N if multithreading should be disabled
All i want is to pass parameters %1, %2, %3, %4 and %5... the rest should not be set...
Can somebody please tell me how this works? I searched the web and tried for hours but i won`t get this.
Thanks and greets!
Upvotes: 0
Views: 12324
Reputation: 993
It looks to me like the author of this batch file allows you to use it in 2 different ways,
Option 1 Just pass the parameters on the command line,
file.bat Param1 Param2 Param3 .....
Option 2
set the variables listed and then call the batch file with the single parameter that is exactly PARAM
.
SET epin=Param1
SET epout=Param2
...
file.bat PARAM
Upvotes: 1
Reputation: 56155
use a short batchfile (in fact it is very short: one line) (you could name it "DoFile.bat")
@file.bat %1 %2 %3 %4 %5 Y "250" Y Y 3 N
It takes 5 parameters and starts the wanted batch with the full amount of 11 parameters.
It might be neccessary to adapt it a little bit to the needs of file.bat
(no errorhandling included)
Upvotes: 0
Reputation: 57252
what is the problem with ?:
set "epin=%~dpfn1"
set "epout=%~dpfn2"
set "epinext=%~3"
if /I not .%epinext% equ .imf (
if /I not .%epinext% equ .idf (
echo wrong extension
exit /b 1
)
)
set "epwthr=%%~dpfnx4"
set "eptype=%%~5"
Upvotes: 0