namespace ArLi.CommonPrj {
public class GetCommandLineEx {
public static readonly System.Version myVersion = new System.Version(1,1);
/// <summary>
/// LocalHost
/// </summary>
public static string CommandLine_WMI(){
System.Management.ManagementScope ms = new System.Management.ManagementScope(@"\\.\root\cimv2");
System.Management.ObjectQuery oq = new System.Management.ObjectQuery("select * from win32_process");
ManagementObjectSearcher query = new ManagementObjectSearcher(ms,oq);
ManagementObjectCollection moc = query.Get();
string s = "";
foreach(ManagementObject mo in moc) {
s += (string)mo["CommandLine"] + "\r\n";
}
return s;
}
}
}
但是这个
CommandLine
Data type: string
Access type: Read-only
Command line used to start a specific process, if applicable. This property is new for Windows XP.