ashok73
asked on
How to accept Input in Batch file
I have a batch file in that i want the user to key in the input , Store it in a variable and then do the processing...
For example
C> abc.bat
It should ask "Enter Source Directory"
Thanks in Advance.
For example
C> abc.bat
It should ask "Enter Source Directory"
Thanks in Advance.
ASKER
Thanks for the comment . But is it possible to have accepting kind of facility in Batch file ????
I heard there is a command called Choice , Is it correct ???
I heard there is a command called Choice , Is it correct ???
Choice.com is DOS utility that "knows" how to return diferent error level according to the answer.
For example:
choice (you get [Y/N] and you need to push Y or N)
IF ERRORLEVEL 2 GOTO noAnswer
... (yes answer)
GOTO end
:noAnswer
... (no answer)
:end
For example:
choice (you get [Y/N] and you need to push Y or N)
IF ERRORLEVEL 2 GOTO noAnswer
... (yes answer)
GOTO end
:noAnswer
... (no answer)
:end
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
rin1010 Thanks for your help.
thanks to Dimiltry as well..
Bye.
thanks to Dimiltry as well..
Bye.
ASKER
rin1010 Thanks for your help.
thanks to Dimiltry as well..
Bye.
thanks to Dimiltry as well..
Bye.
You're most welcome, ashok...
btw... Was the B grade the default
or are my comments somehow deficient?
to use command line parameters.
For example if you want to pass source directory to the batch file, you need to do:
abc.bat c:\srcdir
and in batch file you can use %1 as variable with value c:\srcdir