$processName = "notepad.exe"
$objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$colProcesses = $objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name='" & $processName & "'")
For $objProcess In $colProcesses
$processPath = $objProcess.ExecutablePath
MsgBox(0, "Notepad Path", $processPath)
Next
在此示例中,我們使用WMI查詢來獲取所有名稱為“notepad.exe”的進(jìn)程,并使用$objProcess.ExecutablePath屬性獲取進(jìn)程路徑。最后,我們將路徑顯示在一個消息框中。
請注意,使用WMI查詢可能會比使用AutoIt函數(shù)更慢,因此建議在可能的情況下使用AutoIt函數(shù)。文章源自網(wǎng)吧系統(tǒng)維護(hù)-http://www.s143.cn/10572.html 文章源自網(wǎng)吧系統(tǒng)維護(hù)-http://www.s143.cn/10572.html
版權(quán)聲明:文章圖片資源來源于網(wǎng)絡(luò),如有侵權(quán),請留言刪除!!!


評論