Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any straightforward way to call a .bat file and have it prompt me for each of the arguments that will replace the %1 %2 and so forth fields? I can memorize their order just fine and run it from the command line, but it would be preferable for friends & family if there was an icon they could just click and get the appropriate prompts.

share|improve this question
up vote 6 down vote accepted
@echo off
echo "Parameter 1" 
set /p p1=
echo "Parameter 2"
set /p p2=
yourcommand.exe %p1% %p2% [...]

@echo off stops commands being printed. We will ask for a parameter each using echo, set /p p1= asks the user for some input (use "return" or "enter" to confirm) and stores it into variable %p1%. In the last line you can call your program with the parameters entered.

share|improve this answer
Could you provide some explanation about what your code does? Especially the set statements. – Tom Wijsman Oct 31 '11 at 13:18
set just asks for some input and stores it into a variable. – Jens Erat Oct 31 '11 at 15:46
As a note, at least for some versions of windows (I haven't tested) the set commands can be simplified to set /p pn="Parameter n: " – Russell S. Pierce Mar 23 '12 at 15:31

You can ask the user for parameters with set /p.

Optionally, you can check if %1 exists first. e.g. with if "%1"=="" or something similar.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .