2

I have a program which I want to start using the command prompt and at the same time I want to pass 2 parameters to it. So, for example, when I wanted to start my program I would open the command prompt (in XP: start > run, type cmd, press return) and then type:

c:\rand\anotherfolder\myprogram.exe 10 20

Since I know nothing about batch files, I'm asking two things:

  • Can I create a batch file to automatize this process?
  • If yes, how :D?
1
  • Could you clarify; do you want a batch file that takes two parameters and passes them to your 'myprogram.exe' or do you want a batchfile that runs 'myprogram.exe' with two fixed values, 10 and 20? Batch files are literally a 'batch' of commands that you'd execute at a command line. Commented Aug 22, 2013 at 0:15

1 Answer 1

3

I'll edit this if you respond to my comment but if you want to simply execute this command via a batch file (and you know nothing about batch files):

  1. Open a text editor (e.g.Notepad)
  2. Type in your command (e.g. c:\rand\aotherfolder\myprogram.exe 10 20)
  3. Save the file as mybatchfile.cmd
  4. Double click the file (in Windows Explorer etc.)
Sign up to request clarification or add additional context in comments.

1 Comment

@plymouth223, How can I ask user to enter values on command prompt, like I dont want to hard code 10,20?

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.