我正在使用的Windows 7如何停止在Windows中运行的VB脚本
我写了一个脚本来检查我的笔记本电脑是否在电池或AC电流运行。 我用它搜索并在那里成功。
dim a
a=1
Do While a=1
If IsLaptop(".") Then
' WScript.Echo "Laptop"
Else
' WScript.Echo "Desktop or server"
End If
Loop
Function IsLaptop(myComputer)
On Error Resume Next
Set objWMIService = GetObject("winmgmts://" & myComputer & "/root/cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Battery", , 48)
IsLaptop = False
For Each objItem in colItems
if objItem.BatteryStatus=2 and objItem.EstimatedChargeRemaining=98 then
WScript.Echo "Remove Ac Adapter Immediately"
elseif objItem.BatteryStatus=1 and objItem.EstimatedChargeRemaining=10 then
WScript.Echo "Pluggin to charger immediately"
end if
Next
If Err Then Err.Clear
On Error Goto 0
End Function
但我现在的问题是。如果我希望手动终止,此脚本永远在运行脚本如何停止。
有没有什么方法可以去找到这个过程并停止在Windows?
您能否详细说明您的答案,并添加关于您提供的解决方案的更多描述? – abarisone