在 PowerShell 中,进程管理是一个重要的任务,涉及到启动、停止、查询和管理进程。以下是一些常用的命令和技巧,帮助你在 PowerShell 中进行进程管理。
1 . 获取进程信息1.1 Get-ProcessGet-Process 命令用于获取当前系统上运行的进程信息。
基本用法:
1Get-Process
按名称过滤:
1Get-Process -Name notepad
按 ID 过滤:
1Get-Process -Id 1234
详细信息:
1Get-Process -Name notepad | Select-Object Id, Name, CPU, WS
2 . 启动进程2.1 Start-ProcessStart-Process 命令用于启动新的进程。
基本用法:
1Start-Process notepad.exe
带参数启动:
1Start-Process notepad.exe -ArgumentList "C:\example.txt"
后台启动:
1Start-Process notepad.exe -NoNewW ...