I have an requirement to run one EXE. It will take 7 parameters out of which one parameter is dynamic. Could some one help me how to run the EXE by passing dynamic parameters using bat file.
Thanks Chaitanya
If you need to execute a command with a dynamic number of parameters you can use %*
.
foo.exe [options] <file1> <file2> ...
Say you wanted to have a batch script which sets some options but still passes a dynamic number of files
@ECHO OFF;
foo.exe -some -option %*
Running:
foo.bat file1.txt file2.txt
Translates To:
foo.exe -some -option file1.txt file2.txt
If you want to run this :
my_7_param_program.exe p1 p2 p3 p4 p5 p6 p7
With, say, p4 as a dynamic parameter, try this batch file:
@my_7_param_program.exe p1 p2 p3 %1 p5 p6 p7
and call it like this :
c:\> my_batch.bat 42
So the actual call will be
my_7_param_program.exe p1 p2 p3 42 p5 p6 p7
With the p1, p2, p3, p5, p6 and p7 hardcoded parameters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With