如何在CMD多个参数传递给批处理文件

如何在CMD多个参数传递给批处理文件

本文介绍了如何在CMD多个参数传递给批处理文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不明白这一点。我想多个参数传递给一个批处理文件,有如下描述:

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

我要的是传递参数%1%2%3%4%和5 ...其余不应设置...

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.

感谢和问候!

推荐答案

在我看来这样的批处理文件允许您以两种不同的方式使用它的作者,

It looks to me like the author of this batch file allows you to use it in 2 different ways,

选项1
 只是通过在命令行参数,

Option 1 Just pass the parameters on the command line,

file.bat Param1 Param2 Param3 .....

选项2

设置列出的变量,然后调用与恰好是单参数的批处理文件 PARAM

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

这篇关于如何在CMD多个参数传递给批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 12:42