2012-11-29 59 views
1

有沒有辦法使用vbscript暫停和恢復進程?目前我創建了一個終止進程的輸入框,但不是終止它,有沒有辦法暫停它?如何暫停/恢復使用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 

回答

0

AFAIK您不能通過腳本API從VBScript暫停或恢復進程。對於這種類型的任務,你不得不掏出pssuspend之類的東西。