【问题标题】:VBscript Automate command line "Yes/No" q‌u‌e‌s‌t‌i‌o‌nVBscript 自动化命令行“是/否”q‌u‌e‌s‌t‌i‌o‌n
【发布时间】:2012-10-02 18:47:47
【问题描述】:

我有一个 VBscript 可以停止并启动一个进程。

命令行中弹出是/否问题我需要回答“是” 我怎样才能务实地做到这一点?

到目前为止我有:

Option Explicit
Dim wshShell
On Error Resume Next
   Set wshShell = WScript.CreateObject("WSCript.shell")
   If Err.Number <> 0 Then
      Wscript.Quit
   End If
   wshShell.Run  "cmd.exe /C cd C:\WINDOWS\system32 & process.exe STOP"
   WScript.Sleep 15000
   wshShell.Run  "cmd.exe /C cd C:\WINDOWS\system32 & process.exe START"
On Error Goto 0

【问题讨论】:

    标签: shell command-line vbscript automation shell-exec


    【解决方案1】:

    在需要输入的程序上使用这个例子:

    wshShell.Run  "cmd.exe /C cd C:\WINDOWS\system32 & ( echo Yes|process.exe STOP )"
    

    echo Yes 命令将包含ENTER 键。即:Y + e + s + ENTER

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-08-20
      • 1970-01-01
      • 2017-09-18
      • 2011-07-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多