[已解决]通过AU3获取进程路径,不要WMI等
本帖最后由 jycel 于 2010-4-5 14:01 编辑网吧刚换成了无盘,发现使用不了WMI一用就报错
下面是通过wmi获取所有进程的PID、名称及路径,有法用AU3实现么?
目的就是获取指定进程的路径
$objWMIService = ObjGet("winmgmts:\\.\root\CIMV2:win32_process")
$colItems = $objWMIService.instances_
For $objItem In $colItems
$Pid ="Pid: " & $objItem.ProcessId
$Name = "Name: " & $objItem.Name
$path = "Path: " & $objItem.executablepath
MsgBox(0,'',$Pid&@LF _
&$Name&@LF _
&$path)
Next
$iPid=ProcessExists("explorer.exe")
MsgBox(0,"",_GetModuleFileNameEx($iPid))
Func _GetModuleFileNameEx($_Pid)
$_Hwnd=DllCall("Kernel32.dll","hwnd","OpenProcess","dword",0x0400+0x0010,"int",0,"dword",$_Pid)
$_Return=DllCall("Psapi.dll","long","GetModuleFileNameEx","hwnd",$_Hwnd,"long",0,"str",0,"long",255)
DllCall("Kernel32.dll","int","CloseHandle","hwnd",$_Hwnd)
If StringInStr($_Return,"\") Then Return $_Return
Return ""
EndFunc 谢谢!马上测试下! 感谢2楼的代码。学习了 终于可以看了,等得蛋疼啊。 感谢2楼的代码。学习了 感谢2楼的代码。学习了 谢谢二楼的代码。正好需要
页:
[1]