Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Getting Arguments from a Running Process
var processes = Process.GetProcessesByName( "MyProcess" );
var managementObjectSearcher = new ManagementObjectSearcher( "select CommandLine from Win32_Process where Name='MyProcess.exe'" );
var managementObjects = managementObjectSearcher.Get();
foreach( var managementObject in managementObjects )
{
var command = (string)managementObject["CommandLine"];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment