国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > VBScript > 正文

vbs實現的tasklist效果代碼

2020-07-26 11:20:16
字體:
來源:轉載
供稿:網友

This short script uses WMI to display the same information than in the tool "tasklist", but dumping the result on the console. It can dump remote tasks running on another computer,
這個簡短的腳本使用wmi顯示與工具“tasklist”中相同的信息,但只有在命令行下輸出結果。它也可以在另一臺計算機上查看遠程任務,
文件名:tasklist.vbs
要求:無
作者:Jean-Luc Antoine
提交日期:2005年7月14日
類別:4K

核心代碼

Option explicit If right(Ucase(WScript.FullName),11)="WSCRIPT.EXE" Then	wscript.echo "You should run this script from the command line (cmd)" & vbCrLf & "cscript " & wscript.ScriptFullName	WScript.QuitEnd Ifdim strComputer,objWMIService,colProcesses,objProcess,ProcessTime,strCreationDate,user,Domain,strOwner,h,m,s,chainestrComputer = "." Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!//" & strComputer & "/root/cimv2") Set colProcesses = objWMIService.ExecQuery ("Select * from Win32_Process")    ' where Name='IEXPLORE.EXE' Chaine="Process   |Creation Date Time |Handles|Threads|Owner       |Priority|MemoryUsage|MaxMemUsage|MemRequired|MaxMemRequi|    Swap|  Max Swap|CPU time|PID |PFaults|Path" & vbCrLf For Each objProcess in colProcesses     If objProcess.GetOwner ( User, Domain ) = 0 Then         strOwner= Domain & "/" & User     Else         strOwner="Unknown"     End If     ProcessTime=(CSng(objProcess.KernelModeTime) + CSng(objProcess.UserModeTime)) / 10000000     h=right("0" & fix(ProcessTime/60/60),2)     ProcessTime=ProcessTime-h*60*60     m=right("0" & fix(ProcessTime/60),2)     s=Right("0" & round(ProcessTime-m*60),2)     strCreationDate=Mid(objProcess.CreationDate,7,2) & "/" & Mid(objProcess.CreationDate,5,2) & "/" & Left(objProcess.CreationDate,4) & " " & Mid(objProcess.CreationDate,9,2) & ":" & Mid(objProcess.CreationDate,11,2) & ":" & Mid(objProcess.CreationDate,13,2)     If strCreationDate="http:// ::" Then strCreationDate=Space(19)     Chaine=Chaine & Left(objProcess.Name & space(8),12) & "|" _         & strCreationDate & "|" & Right(Space(6) & objProcess.HandleCount,7) & "|" _         & Right(Space(6) & objProcess.ThreadCount,7) & "|" _         & Left(strOwner & space(14),19) & "|" _         & Left(objProcess.Priority & Space(7),8) & "|" _         & Right(Space(10) & objProcess.PageFileUsage ,11) & "|" _         & Right(Space(10) & objProcess.PeakPageFileUsage ,11) & "|" _         & Right(Space(8) & objProcess.WorkingSetSize ,11) & "|" _         & Right(Space(8) & objProcess.PeakWorkingSetSize ,11) & "|" _         & Right(Space(10) & objProcess.VirtualSize ,11) & "|" _         & Right(Space(10) & objProcess.PeakVirtualSize ,11) & "|" _         & h & ":" & m & ":" & s & "|" _         & Left(objProcess.ProcessID & space(3),4) & "|" _         & Right(Space(6) & objProcess.PageFaults ,7) & "|" & objProcess.ExecutablePath     Chaine=Chaine & vbCrLf Next wscript.echo chaine

代碼運行方法,將上面的代碼為tasklist.vbs

在cmd下 cscript tasklist.vbs 即可,也可以在cmd下 cscript tasklist.vbs >list.txt直接將結果保存為list.txt查看也比較容易

好了,代碼到此結束

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 麻城市| 阜宁县| 工布江达县| 始兴县| 吴江市| 格尔木市| 广德县| 普兰店市| 丹江口市| 西乌珠穆沁旗| 和平区| 古田县| 田阳县| 潞城市| 伊金霍洛旗| 砚山县| 田东县| 乐安县| 阿城市| 拜城县| 四川省| 密山市| 阿拉善盟| 抚州市| 蒙山县| 清水河县| 巴东县| 屏东市| 肥东县| 鲁山县| 全州县| 重庆市| 陵水| 北辰区| 文昌市| 松原市| 措美县| 青浦区| 桓台县| 江安县| 永仁县|