English 中文(简体)
如何在Windows脚本中获得用户输入(通过对话框窗口)?
原标题:How can I get user input (via a dialog window) in a Windows script?

我想创建一个从CMD提示符下运行的简单搜索脚本。它需要首先请求用户输入,例如“搜索什么”。

如何提示用户输入(用cmd),或打开输入对话框(用任何标准的脚本Windows语言)。

最佳回答

在命令提示下,可以使用StdIn

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

这篇文章非常全面地介绍了在Windows脚本中获取用户输入的不同方法。它有点过时,但仍然很有帮助。

问题回答

您可以通过vbscript中的<code>InputBox</code>函数使用用户输入对话框

myString=InputBox("Enter")
WScript.Echo myString




相关问题
What does it mean "to write a web service"?

I just asked a question about whether it was possible to write a web-page-checking code and run it from free web server, and one supporter answered and said that it was possible only if I run "a web ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Dynamically building a command in bash

I am construcing a command in bash dynamically. This works fine: COMMAND="java myclass" ${COMMAND} Now I want to dynamically construct a command that redirectes the output: LOG=">> myfile.log ...

Why does Scala create a ~/tmp directory when I run a script?

When I execute a Scala script from the command line, a directory named "tmp" is created in my home directory. It is always empty, so I simply deleted it without any apparent problem. Of course, when I ...

Ivy, ant and start scripts

I have a project that uses ant to build and ivy for dependencies. I would like to generate the start scripts for my project, with the classpath, based on the dependencies configured in Ivy, ...

热门标签