Reputation: 7592
I have a executable "myfile.exe
" file in location "C:\Users\me\Desktop
" I want to execute a command "myfile.exe <firstArg> <secondArg>
" at C:\Users\me\Desktop
through batch file,
In command line:
C:\Users\me\Desktop>myfile.exe <firstArg> <secondArg>
How to write the batch script for the above command in windows
Upvotes: 0
Views: 2321
Reputation: 912
With argument variables the contents of you batchFile.bat would be:
@echo off
C:\Users\me\Desktop\myfile.exe %1 %2
or with fixed arguments:
@echo off
C:\Users\me\Desktop\myfile.exe <firstArg> <secondArg>
Upvotes: 1
Reputation: 6401
Your batch file:
C:\Users\me\Desktop\myfile.exe %1 %2
Then you can call your batch file:
mybatchfile.bat <firstArg> <secondArg>
Also, you can use %* to pass all parameters rather than specifying each parameter.
Upvotes: 0
Reputation: 14521
Just add the exact command you are executing from command line to .bat
file.
Change working directory first if necessary.
cd C:\Users\me\Desktop
myfile.exe <firstArg> <secondArg>
Upvotes: 0