"Tony Bansten" <tonytony@xxxxxx> wrote in message
>I would like to read a user input from command line and store it in a
> In good ol' DOS batch scripts there is a command:
> set /p aaa="Please enter value: "
> How do I do this in VBscript?
> Is there a way to define a default value? In other words if the user
> simply hits RETURN
> the value in variable aaa should not be empty but contain instead e.g.
> "unknown" or 0 (=zero)
> How do I define such a default value in VBscript?
> Again: the input should not be entered in a GUI based entry field but at
> the command prompt.
Strange . . . for a long time people have been complaining about the
unfriendly black-screen user input method offered by set /p, and now you
wish to use precisely this unfriendly technique . . . AFAIK, VB Script has
no such facility. Its input tool is, as you probably know, the InputBox
A rather clumsy way to meet your requirement would be to use a batch file
that does two things:
- It uses set /p to prompt the user for an input.
- It writes the response to a text file.
Your VB Script will also do two things:
- If invokes the batch file like so:
oWshShell.Run "d:\temp\test.bat", 3, True
- It reads the input from the text file.
I think the InputBox method would be a lot more elegant.