我有一个VBscript可以停止进程并启动它。
在命令行中弹出一个Yes / No问题,我需要回答“是” 我怎么能务实地做到这一点?
到目前为止,我有:
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
答案 0 :(得分:1)
在想要输入的程序中使用此示例:
wshShell.Run "cmd.exe /C cd C:\WINDOWS\system32 & ( echo Yes|process.exe STOP )"
echo Yes
命令将包含ENTER
密钥。即:Y
+ e
+ s
+ ENTER