How to create a batch file that do following:
For example program name is hi.exe
will do the following:
- Run
hi.exe
in cmd with argumentshi.exe -f%l%
. - Instead of
%1%
I want user to input the number of his choice.
command linewindows
How to create a batch file that do following:
For example program name is hi.exe
will do the following:
hi.exe
in cmd with arguments hi.exe -f%l%
.%1%
I want user to input the number of his choice.
Best Answer
1) You do not need to open a cmd window separately. You can use
start
command followed by path of exe. Check here: https://stackoverflow.com/questions/221730/bat-file-to-run-a-exe-at-the-command-prompt2) To read arguments you can use a statement like:
set /p name= What is your name?
which prompts user with question "What is your name?" and accepts the input in variable 'p'. Check here for more: https://stackoverflow.com/questions/1223721/in-windows-cmd-how-do-i-prompt-for-user-input-and-use-the-result-in-another-com