Discussion Locked

keyboard input when running batch file

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

How do I accept a keyboard input when running a NT batch file written in command language .

I could not find any command which will allow
me to read a value from keyborad .

Please help .

Thanks

5 replies

by joncr

"Choice" is ok if you only want one character input but for strings I use ask.exe.
If you cant find it on the internet I can mail you a copy. It prompts for a entry and then sets an environment variable to the entered value. e.g.

ask testvar What server do you want to connect to?
would ask "What server do you want to connect to?" and wait for a servername to be entered. The environment variable testvar is then set to the input. This can be used as any other environment variable such as:net use f: \\%testvar%\c$

This discussion is closed to new replies.