How can I get user input (via a dialog window) in

2019-05-24 00:36发布

I'd like to create a simple search script that runs from the CMD prompt. It needs to asks for user input first e.g. "what to search".

How can I prompt the user for input (in cmd), or open a input dialog (in any standard scripting Windows language).

2条回答
男人必须洒脱
2楼-- · 2019-05-24 01:23

you can use user input dialog via InputBox function in vbscript

myString=InputBox("Enter")
WScript.Echo myString
查看更多
贪生不怕死
3楼-- · 2019-05-24 01:31

At the command prompt, you can use StdIn:

Wscript.StdOut.Write "Enter a number: "
strNumber = Wscript.StdIn.ReadLine

This article is a pretty comprehensive look at different ways of getting user input in Windows Scripting. It's a bit old, but still helpful.

查看更多
登录 后发表回答