我有一些需要运行的命令行实用程序的 vbs 文件。但在某些情况下,这些实用程序可能会提示用户输入以继续。我希望能够捕获这些条件,提供“是”的默认答案,然后继续。
这是我到目前为止所拥有的:
Dim oExec
set oExec = objShell.Exec("mycmd pw ....")
do while not oExec.StdOut.AtEndofStream
wscript.echo "status of script: " & oExec.Status
input = input & oExec.StdOut.ReadLine()
if instr(input, "create key? (y/n)") <> 0 Then exit do
loop
oExec.Stdin.Write "y"
当我这样做时,什么也没有发生。我看到我插入的调试语句......但脚本似乎挂起。
任何帮助,将不胜感激。