查看正在运行的进程来自哪个文件
用 Get-Process 的 Path 属性或 Win32_Process 的 ExecutablePath,查看进程可执行文件在磁盘上的位置。
运行 `(Get-Process -Id 1234).Path`(把 1234 换成 PID),或 `Get-CimInstance Win32_Process -Filter "ProcessId=1234" | Select-Object Name, ExecutablePath`。
01命令
命令
$ (Get-Process -Id 1234).Path :: or: Get-CimInstance Win32_Process -Filter "ProcessId=1234" | Select-Object Name, ExecutablePath02作用说明
查看可执行文件所在目录是判断程序是否可信的最快方法——真正的 Windows 系统文件位于 System32 或 Program Files,而不是 Temp 或 AppData。Get-Process 通过 Process 对象的 .Path 属性返回路径;Win32_Process 则通过 CIM 提供同样信息的 ExecutablePath 属性。
03风险
!注意: 对不属于自己的受保护系统进程,Path 可能为空——请用管理员身份运行 PowerShell 后重试。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- Get-Process依据: Get-Process returns System.Diagnostics.Process objects whose Path property (documented on the Process class) gives the full path of the executable; cmdlets accept -Id to target a process by PID.
- Win32_Process class依据: Class definition lists the ExecutablePath string property ('the path to the executable file of the process').
最后验证: 2026-09-19 · 分类: 系统与设置