2

有没有办法使用 vbscript 暂停和恢复进程?目前我创建了一个输入框来终止进程但不是终止它有没有办法暂停它?

'Terminate all processes involving the name <strProcessToKill>
Option Explicit
Dim strComputer, strProcessToKill, objWMIService, colProcess, objProcess

strComputer = "."
strProcessToKill = InputBox("Process to kill","Userinput")
Set objWMIService = GetObject("winmgmts:" _ 
   & "{impersonationLevel=impersonate}!\\" _ 
   & strComputer _ 
   & "\root\cimv2") 
Set colProcess = objWMIService.ExecQuery _
   ("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")
For Each objProcess in colProcess
   msgbox "... terminating " & objProcess.Name
   objProcess.Terminate()
Next
4

1 回答 1

0

AFAIK,您无法通过脚本 API 暂停或恢复 VBScript 的进程。您必须pssuspend为此类任务付出类似的代价。

于 2012-12-02T21:49:54.213 回答