脚本 – 如何停止在Windows中运行的vb脚本
发布时间:2020-12-13 20:42:00 所属栏目:Windows 来源:网络整理
导读:我正在使用Windows 7 我写了一个脚本来检查我的笔记本电脑是以电池还是交流电流运行. 我用谷歌搜索并在那里成功. dim aa=1Do While a=1 If IsLaptop( "." ) Then ' WScript.Echo "Laptop"Else ' WScript.Echo "Desktop or server"End IfLoopFunction IsLapto
我正在使用Windows 7
我写了一个脚本来检查我的笔记本电脑是以电池还是交流电流运行. 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中吗?
我至少可以想到两种不同的方式:
>使用任务管理器(Ctrl-Shift-Esc),选择进程选项卡,查找进程名称cscript.exe或wscript.exe并使用End Process. 另一种方法是使用脚本和WMI.以下是一些提示:查找Win32_Process类和Terminate方法. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- Windows账户管理
- Windows Containers 大冒险: 优化计划(Dockerfile)
- 如何使用VS在Windows 7上安装Boost
- windows-server-2008 – Windows备份到网络共享(Server 200
- 在Windows Phone 8 Bing地图上设置图钉(XAML C#)
- Windows:文件监控脚本(批处理/ VBS)
- Windows – 3月10日补丁星期二似乎导致SQL Server客户端连接
- 针对IIS7和Windows 2008的iOS“didReceiveAuthenticationCh
- windows – DNS查询追加父后缀两次
- windows-server-2003 – 如何修复“系统启动期间至少有一个