How to get Command Line info for a process in PowerShell or C#
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: e.g: if I run notepad.exe c:\autoexec.bat , How can I get c:\autoexec.bat in Get-Process notepad in PowerShell? Or how can I get c:\autoexec.bat in Process.GetProcessesByName("notepad"); in C#? 回答1: In PowerShell you can get the command line of a process via WMI: $process = "notepad.exe" Get - WmiObject Win32_Process - Filter "name = '$process'" | Select - Object CommandLine Note that you need admin privileges to be able to access that information about processes running in the context of another user. As a normal user it's only