查看正在运行的进程来自哪个文件

用 Get-Process 的 Path 属性或 Win32_Process 的 ExecutablePath,查看进程可执行文件在磁盘上的位置。

Windows进程系统PowerShell低风险
运行 `(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, ExecutablePath

02作用说明

查看可执行文件所在目录是判断程序是否可信的最快方法——真正的 Windows 系统文件位于 System32 或 Program Files,而不是 Temp 或 AppData。Get-Process 通过 Process 对象的 .Path 属性返回路径;Win32_Process 则通过 CIM 提供同样信息的 ExecutablePath 属性。

03风险

风险低风险
使用条件The Path property is only readable for processes you have access to; system processes need an elevated (Administrator) prompt.
!注意: 对不属于自己的受保护系统进程,Path 可能为空——请用管理员身份运行 PowerShell 后重试。

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • Get-Process
    Microsoft Learn · vendor-doc · 2026-09-17
    依据: 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
    Microsoft Learn · vendor-doc · 2026-09-17
    依据: Class definition lists the ExecutablePath string property ('the path to the executable file of the process').

最后验证: 2026-09-19 · 分类: 系统与设置

06相关方案