0

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!

3 Answers 3

1

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
Sign up to request clarification or add additional context in comments.

3 Comments

Hello StocksR. Thank you for your answer. Can you tell me how I can use option 1 for cmd and dont set the other parameters? just dont pass them gives me an error.
Hi, for a better answer you will need to provide details of the error you get. However I would guess that the author of this batch file has written it to to require the remaining parameters. Are you attempting to modify this file or simply to use it?
thank you. Solved the problem. The problem was not passing the parameters but an incorrect batch file. Just exchanged it trough another version.
0

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"

3 Comments

sorry I think my question is not quite clear. I want to pass the first 5 parameters with the windows console cmd and ONLY the first 5 . If I just pass the first five like: C:/EnergyPlusV7-2-0/Epl-run.bat C:/EnergyPlusV7-2-0/ExampleFiles/1ZoneEvapCooler C:/Users/DonMaier/idf_rest_output/result idf C:/EnergyPlusV7-2-0/WeatherData/USA_CO_Golden-NREL.724666_TMY3.epw it won`t go
This will set only the 5 parameters.And you can use them for whatever you want...So you need something that will truncate the parameters after the fifth????
Hello @npocmaka, i wanted to use the command as String and use it in my Java Application: Runtime rt = Runtime.getRuntime(); Process pr = rt.exec(command); I thought it would be possible to just create one CommandString. I dont know how to implement your suggestion in Java. Im still a beginner.
0

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)

1 Comment

Thank you. Also a nice answer. Think I`ll gonna do that

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.