state = 1
While state = 1
Set WshShell = WScript.CreateObject ("WScript.Shell")
Set colProcessList = GetObject("Winmgmts:").ExecQuery ("Select * from Win32_Process")
Set oShell = CreateObject ("Wscript.Shell")
For Each objProcess in colProcessList
if objProcess.Name = "server.exe" And objProcess.Name = "cmd.exe" then
vFound = True
End if
Next
If vFound = True then
wscript.sleep 10000
Else
Dim strArg, strArgs
strArg = "pskill /accepteula cmd.exe"
strArgs = "%windir%\psexec /accepteula \\server test.exe"
oShell.Run strArg & oShell.Run strArgs, 0, false
wscript.sleep 10000
End If
vFound = False
Wend
请帮助我正确运行此脚本,我要做的是,如果在进程中找不到“server.exe”和“cmd.exe”,请运行 Dim strArg 和 strArgs。