如何在 Windows 上列出進程樹?

如何在 Windows 上列出進程樹?

我知道在 Linux 中該命令非常有用pstree,類似的東西就是我正在尋找的...但是如何在 Windows 終端機上製作詳細的進程列表(樹)?

答案1

你可以使用一個名為過程監控器。這個程式可以讓你做你想做的事。

Process Monitor 是 Windows 的進階監控工具,可顯示即時檔案系統、登錄和進程/執行緒活動。它結合了兩個傳統Sysinternals 實用程式Filemon 和Regmon 的功能,並添加了廣泛的增強功能,包括豐富的非破壞性過濾、會話ID 和用戶名等綜合事件屬性、可靠的進程資訊、具有整合符號支持的完整線程堆疊對於每個操作,同時記錄到文件等等。其獨特的強大功能將使進程監視器成為系統故障排除和惡意軟體搜尋工具包中的核心實用程式。

它還提供了您想要的:

進程樹工具顯示追蹤中引用的所有進程的關係。

答案2

使用pslist64.exe -t來自系統內部

答案3

嘗試行程瀏覽器來自系統內部。它就像一個高階任務管理器,還有一個樹狀視圖。

答案4

此 powershell cmdletPrint-ProcessTree將列出原始進程樹。

function Print-ProcessTree() {

    function Get-ProcessAndChildProcesses($Level, $Process) {
        "{0}[{1,-5}] [{2}]" -f ("  " * $Level), $Process.ProcessId, $Process.Name
        $Children = $AllProcesses | where-object {$_.ParentProcessId -eq $Process.ProcessId -and $_.CreationDate -ge $Process.CreationDate}
        if ($null -ne $Children) {
            foreach ($Child in $Children) {
                Get-ProcessAndChildProcesses ($Level + 1) $Child
            }
        }
    }

    $AllProcesses = Get-CimInstance -ClassName "win32_process"
    $RootProcesses = @()
    # Process "System Idle Process" is processed differently, as ProcessId and ParentProcessId are 0
    # $AllProcesses is sliced from index 1 to the end of the array
    foreach ($Process in $AllProcesses[1..($AllProcesses.length-1)]) {
        $Parent = $AllProcesses | where-object {$_.ProcessId -eq $Process.ParentProcessId -and $_.CreationDate -lt $Process.CreationDate}
        if ($null -eq $Parent) {
            $RootProcesses += $Process
        }
    }
    # Process the "System Idle process" separately
    "[{0,-5}] [{1}]" -f $AllProcesses[0].ProcessId, $AllProcesses[0].Name
    foreach ($Process in $RootProcesses) {
        Get-ProcessAndChildProcesses 0 $Process
    }
}

修改自實際管理員.nl

相關內容