复制代码 代码如下:
Delay = 5000
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create("C:\Program Files\Internet Explorer\iexplore.exe http://www.jb51.cn", null, objConfig, PID)
If errReturn = 0 Then
WScript.Echo "Process ID is: " & PID
End If
wscript.sleep Delay
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process Where ProcessId = '" & PID & "'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
WScript.Echo "Close ProcessId = '" & PID & "'"
将上面保存为 1.vbs
运行方法,在cmd 里面
cscript 1.vbs
看效果
Delay = 5000
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create("C:\Program Files\Internet Explorer\iexplore.exe http://www.jb51.cn", null, objConfig, PID)
If errReturn = 0 Then
WScript.Echo "Process ID is: " & PID
End If
wscript.sleep Delay
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process Where ProcessId = '" & PID & "'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
WScript.Echo "Close ProcessId = '" & PID & "'"
将上面保存为 1.vbs
运行方法,在cmd 里面
cscript 1.vbs
看效果
标签:
延时,关闭ie
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
内蒙古资源网 Copyright www.nmgbbs.com
暂无“利用vbs写的延时关闭ie进程的脚本代码”评论...