我不明白。我想将多个参数传递给批处理文件,该文件具有以下描述:
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
我想要的只是传递参数%1,%2,%3,%4和%5 ...其余的不应该设置......
有人可以告诉我这是如何运作的吗?我在网上搜索并试了几个小时,但我不知道这个。
谢谢和问候!
答案 0 :(得分:0)
在我看来,这个批处理文件的作者允许您以两种不同的方式使用它,
选项1 只需在命令行上传递参数
即可file.bat Param1 Param2 Param3 .....
选项2
设置列出的变量,然后使用正好为PARAM
的单个参数调用批处理文件。
SET epin=Param1
SET epout=Param2
...
file.bat PARAM
答案 1 :(得分:0)
有什么问题?:
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"
答案 2 :(得分:0)
使用一个简短的批处理文件(事实上它很短:一行)(你可以将它命名为“DoFile.bat”)
@file.bat %1 %2 %3 %4 %5 Y "250" Y Y 3 N
它需要5个参数并以11个参数的全部数量启动所需批次。
可能需要对file.bat
的需求进行一点调整。
(不包括错误处理)