如何静默循环 VBScript 运行?
How to make a loop VBScript run silently?
我有一个应该使用循环终止 mspaint.exe 进程的 VBScript。
Dim oShell : Set oShell = CreateObject("WScript.Shell")
do
WScript.Sleep 3000
' Kill paint '
oShell.Run "taskkill /im mspaint.exe", , True
loop
它可以工作,但是每次它循环时,命令提示符 window 成为最顶层和活动的 window 大约半秒钟,然后关闭。这很不方便,因为我想在后台 运行。
程序员不会运行用户的命令。
Set objWMIService = GetObject("winmgmts:\.\root\cimv2")
Do
Set colItems = objWMIService.ExecQuery("Select * From Win32_Process")
For Each objItem in colItems
If LCase(objItem.name) = "mspaint.exe" then
objItem.terminate
End If
Next
WScript.Sleep 3000
Loop
我有一个应该使用循环终止 mspaint.exe 进程的 VBScript。
Dim oShell : Set oShell = CreateObject("WScript.Shell")
do
WScript.Sleep 3000
' Kill paint '
oShell.Run "taskkill /im mspaint.exe", , True
loop
它可以工作,但是每次它循环时,命令提示符 window 成为最顶层和活动的 window 大约半秒钟,然后关闭。这很不方便,因为我想在后台 运行。
程序员不会运行用户的命令。
Set objWMIService = GetObject("winmgmts:\.\root\cimv2")
Do
Set colItems = objWMIService.ExecQuery("Select * From Win32_Process")
For Each objItem in colItems
If LCase(objItem.name) = "mspaint.exe" then
objItem.terminate
End If
Next
WScript.Sleep 3000
Loop