Is there a way to write an NT script that allows user input?
What I mean is that I would like to interactively prompt the user for input (say, their name or a transaction number), and capture their response in a variable.
The only way to read lines of input from the command line is using the COPY command.
for example:
echo Enter filename, followed by CTRL+Z:
copy con filename.tmp
The COPY command stops reading when you press ctrl-z, you will then find the contents of what the user pressed in filename.tmp which you should then parse using a FOR /F command.
you do not have much control over this and it's usually better to provide the user with a limited choice of what they can choose and use the CHOICE command.
Thanks to both of you for your helpful replies. I had read about the choice command but couldn't get it to run (duh!) and the info about the copy command will be helpful too.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.