Skip to content

Instantly share code, notes, and snippets.

@JoshClose
Created November 15, 2011 04:44
Show Gist options
  • Save JoshClose/1366172 to your computer and use it in GitHub Desktop.
Save JoshClose/1366172 to your computer and use it in GitHub Desktop.
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