代码之家  ›  专栏  ›  技术社区  ›  Princess

VBscript自动执行命令行“是/否”问题

  •  0
  • Princess  · 技术社区  · 13 年前

    我有一个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
    
    1 回复  |  直到 8 年前
        1
  •  1
  •   Jay    13 年前

    在需要输入的程序上使用此示例:

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

    这个 echo Yes 命令将包括 ENTER 钥匙即: Y + e + s + 输入