作者junorn (威廉华勒斯)
看板EzHotKey
标题Re: [VBS-] 怎麽查询档案公司资料
时间Mon May 18 14:41:06 2009
自问自答
後来研究出来了
SET GetPro = Wmi.ExecQuery("Select * From Win32_Process")
For Each Pro In GetPro
ProPath = Pro.ExecutablePath
IF ProPath <> "" Then
GetFileName (ProPath)
ObjLog.Write "[PID:" & Pro.ProcessID & "] " & _
ProPath & " [" & CompanyName & "]" & vbcrlf
End IF
Next
Sub GetFileName (FilePath)
If FilePath <> "" Then
WMIPathMode=Replace(FilePath,"\","\\")
Set colManufacturer = Wmi.ExecQuery _
("SELECT * FROM CIM_DataFile Where Name='" & WMIPathMode & "'")
For Each OBJManufacturer In colManufacturer
IF Trim(OBJManufacturer.Manufacturer) <> "" Then
CompanyName = OBJManufacturer.Manufacturer
Else
CompanyName = "N/A"
End IF
Next
End IF
End Sub
※ 引述《junorn (威廉华勒斯)》之铭言:
: 小弟找网路的资料 + VBScript 500个活用范例 + MSDN Wmi范例
: 拼凑出了底下的代码
: Set ObjFSO = CreateObject("Scripting.FileSystemObject")
: Set ObjWSH = CreateObject("Wscript.Shell")
: Set Locator = WScript.CreateObject("WbemScripting.SWbemLocator")
: Set Wmi = Locator.ConnectServer
: AA = vbcrlf & "*****************************" & vbcrlf
: SET ObjLog = ObjFSO.OpenTextFile("log.txt",2,true,0)
: SET Env = ObjWSH.Environment("Process")
: SystemRoot = Env("SystemRoot")
: System = Env("SystemRoot") & "\" & "System32"
: ProgramFiles = Env("ProgramFiles")
: SET GetPro = Wmi.ExecQuery("Select * From Win32_Process")
: For Each Pro In GetPro
: ProPath = Pro.ExecutablePath
: IF ProPath > "0" Then
: ObjLog.Write "[PID:" & Pro.ProcessID & "] " & ProPath & vbcrlf
: End IF
: Next
: 後略....
: 想请问的是
: Win32_Process似乎没有参数可以查询档案公司资料
: 那有没有其他方式能够查询从Win32_Process中提出来的档案资讯?
: 目前是有看到有人用CIM_DateFile
: 但用法我还是不了解0rz
--
人间世称做缘 相连的红线不停缠绕
脆弱而惹人悲怜的彼岸花 愤怒、伤感、终日以泪洗面
在凌晨零时的夜幕中 为你消除无法平息的怨恨
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 210.68.130.155
1F:推 ldwang:看不懂orz 纯推 06/01 21:45