windows 下重启进程脚本

strPName = "notepad.exe"
strComputer = "."
Set objShell = CreateObject("Wscript.Shell")
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
    ("Select * from Win32_Process Where Name = '" & strPName & "'")
For Each objProcess in colProcessList
    objProcess.Terminate()
Next
WScript.Sleep 2000
objshell.Run "c:\windows\system32\notepad.exe"
 
――――――――――――――――――――――――――――
注: strPName为进程名
           objshell run 为进程路径
 
 
 

你可能感兴趣的:(windows,职场,进程,重启,休闲)