快活林资源网 Design By www.csstdc.com
今天要说的是用VBS(VBScript脚本)来枚举Windows操作系统的进程,这样做的用处在什么地方呢"htmlcode">
'enum.vbs Dim WMI,Objs,Process Set WMI=GetObject("WinMgmts:") Set Objs=WMI.InstancesOf("Win32_Process") Process="" For Each Obj In Objs Process=Process & Obj.Description & Chr(13) & Chr(10) Next MsgBox Process
我在这儿采用的方式是弹出一个对话框,方便观看嘛,当然你也可以使用FSO来生成一个文本文件保存起来.
前面说到要监控某个进程是否在运行,实现如下.
示例:
'monitor.vbs '检测IE是否在运行中 Dim WMI,Objs,Process Set WMI=GetObject("WinMgmts:") Set Objs=WMI.InstancesOf("Win32_Process") Process="" For Each Obj In Objs 'Process=Process & Obj.Description & Chr(13) & Chr(10) Process = Obj.Description if Process = "iexplore.exe" then msgbox "IE在运行中..." end if Next
呵呵,当然,还可以引申出来其它应用.
下面给大家分享一个列举进程详细列表的vbs
' FileName: ProcessMagnifier.vbs ' Function: Capture information about the running processes in detail ' code by somebody ' QQ: 240460440 ' LastModified: 2007-12-9 18:50 const HKEY_CURRENT_USER = &H80000001 Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv") strKeyPath = "Console\%SystemRoot%_system32_cmd.exe" oReg.CreateKey HKEY_CURRENT_USER,strKeyPath strValueName1 = "CodePage" dwValue1 = 936 strValueName2 = "ScreenBufferSize" dwValue2 = 98304200 strValueName3 = "WindowSize" dwValue3 = 2818173 strValueName4 = "HistoryNoDup" dwValue4 = 0 strValueName5 = "WindowPosition" dwValue5 = 131068 strValueName6 = "QuickEdit" dwValue6 = 2048 oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName1,dwValue1 oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName2,dwValue2 oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName3,dwValue3 oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName4,dwValue4 oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName5,dwValue5 oReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName6,dwValue6 Dim objWSH, FinalPath Set objWSH = WScript.CreateObject("WScript.Shell") If (Lcase(Right(WScript.Fullname,11))="wscript.exe") Then FinalPath = "'" & WScript.ScriptFullName & "'" objWSH.Run("cmd.exe /k cscript //nologo " &Replace(FinalPath,"'","""")) WScript.Quit End If oReg.DeleteKey HKEY_CURRENT_USER, strKeyPath Set oReg = nothing Wscript.Sleep 1000 Mystr = Array(115,111,109,101,98,111,100,121) for i=0 to Ubound(Mystr) author=author&chr(Mystr(i)) Next WScript.Echo WScript.Sleep 3000 WScript.Echo "当前正在运行的进程简要信息列表如下:" WScript.Echo vbCrLf WScript.Sleep 2000 Dim MyOBJProcessName Set OBJWMIProcess = GetObject("winmgmts:\\.\root\cimv2").ExecQuery("Select * From Win32_Process") WScript.Echo "Name: Priority: PID: Owner:" &vbTab&vbTab&"ExecutablePath: " WScript.Echo "---------------------------------------------------------------------------------------" For Each OBJProcess in OBJWMIProcess MyOBJProcessName=OBJProcess.Name&" " colProperties = OBJProcess.GetOwner(strNameOfUser,strUserDomain) WScript.Echo Mid(MyOBJProcessName,1,20) &vbTab& OBJProcess.Priority &vbTab& OBJProcess.ProcessID &vbTab& strNameOfUser &vbTab&vbTab& OBJProcess.ExecutablePath Next WScript.Sleep 5000 WScript.Echo vbCrLf WScript.Echo "当前正在运行的进程以及其加载的模块详细信息树状结构如下:" WScript.Echo vbCrLf WScript.Sleep 3000 WScript.Echo vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab&vbTab& vbTab&"创建时间 文件制造商" Set OBJWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Set OBJRefresher = CreateObject("WbemScripting.SWbemRefresher") Set colItems = OBJRefresher.AddEnum(OBJWMIService,"Win32_PerfFormattedData_PerfProc_FullImage_Costly").ObjectSet OBJRefresher.Refresh For Each OBJItem In colItems Dim originalPath, ModulePath, WMIPathMode, FileManufacturer, LCaseModulePath Dim FileExtension, mark, MyLCaseModulePath, FinalModulePath originalPath = OBJItem.Name ModulePath = Split(originalPath,"/") WMIPathMode = Replace(ModulePath(1),"\","\\") Set OBJWMI = GetObject("winmgmts:\\.\root\CIMV2") Set colManufacturer = OBJWMI.ExecQuery("SELECT * FROM CIM_DataFile Where Name='" & WMIPathMode & "'") For Each OBJManufacturer In colManufacturer FileManufacturer=Trim(OBJManufacturer.Manufacturer) LCaseModulePath=LCase(Trim(OBJManufacturer.Name)) FileExtension=Right(LCaseModulePath, 3) MyLCaseModulePath=LCaseModulePath & " " Set FSO = CreateObject("Scripting.FileSystemObject").GetFile(LCaseModulePath) If FileExtension="exe" Then mark="├—" FinalModulePath=Mid(MyLCaseModulePath,1,118) WScript.Echo "│" Else mark="│├─" FinalModulePath=Mid(MyLCaseModulePath,1,116) End If WScript.Echo mark & FinalModulePath & FSO.DateCreated &vbTab& FileManufacturer Next Next MyVBSPath = "'" & WScript.ScriptFullName & "'" Myclipboard = "cscript //nologo " & Replace(MyVBSPath,"'","""") Set objIE = CreateObject("InternetExplorer.Application") objIE.Navigate("about:blank") objIE.document.parentwindow.clipboardData.SetData "text", Myclipboard
经过测试效果很不错,喜欢vbs的朋友可以学习一下。
快活林资源网 Design By www.csstdc.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
快活林资源网 Design By www.csstdc.com
暂无评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2024年11月16日
2024年11月16日
- 方伊琪.1979-沙鸥(LP版)【星岛全音】【WAV+CUE】
- 蔡琴《醇厚嗓音》6N纯银SQCD【WAV+CUE】
- 陈曦《遇见HQCD》[WAV+CUE]
- 大提琴-刘欣欣《爱的问候》HDCD[WAV+CUE]
- 周耀辉/邓慧中《从什么时候开始》[320K/MP3][95.71MB]
- 周耀辉/邓慧中《从什么时候开始》[FLAC/分轨][361.29MB]
- 蒋荣宗《蒋荣宗ZONG x FOCA 夏日马戏节》[320K/MP3][89.28MB]
- 坣娜.1997-你怎么可以不爱我【巨石】【WAV+CUE】
- 群星.1992-暗恋桃花源电影原声带【滚石】【WAV+CUE】
- 林隆璇.1989-愤怒的情歌【巨石】【WAV+CUE】
- 勤琴《海上花》[DTS-WAV分轨]
- 群星《歌声有故事》[DTS-WAV分轨]
- [发烧人声]群星《邂逅》DTS-WAV
- 艻打绿《夏/狂热(苏打绿版)》[320K/MP3][106.42MB]
- 艻打绿《夏/狂热(苏打绿版)》[FLAC分轨][574.2MB]