string cmd = Environment.CommandLine;
string[] strs = Environment.GetCommandLineArgs();
string[] strs = Environment.GetCommandLineArgs();
解决方案 »
- C# __FILE__ __LINE__
- 随机排列数组中元素(洗扑克牌)
- 帮忙解决一下
- 求关于WinForm中DataGridView控件按照条件分组的问题,超难!!!!!
- double ? 和 double 的区别?
- 我用.net(C#)做了一个小系统,生成网站后,如果直接挂在根目录下,就没问题,能正常运行,但一旦放到子目录下就显示错误
- .NET 2.0 and IBM Websphere 6.0: Web Application Server Performance Comparison
- 搞C/S系统的请帮帮忙,我有问题请教。
- socket里面的BeginReceive,求指导!
- label动态显示循环条数?
- 学习编程中的困惑,哪位兄弟给指点一下?
- 我是新手,请教各位一下。
String cmd = process.StartInfo.FileName + " " + process.StartInfo.Arguments;
Process[] processes = Process.GetProcesses();
string s = null; foreach (Process p in processes) {
s += p.WorkingSet + p.ProcessName + "\r\n" + p.StartInfo.FileName + " " + p.StartInfo.Arguments;
} return s;
}结果是p.StartInfo 里都是空值,因为StartInfo 是要传递的属性而不是用来获取已存在进程的属性
using System.Management;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-onlyCommand line used to start a specific process, if applicable. This property is new for Windows XP.这下可惨了,我的程序要求有win98 哩最少也要win2k 能跑呀,为为,大家一起帮帮忙想想啊
http://contextfree.net/wangyg/tech/myIDE.htm
http://zpcity.com/arli/commonprj/cls_GetCommandLineEx.cs可是还是没法用API 做到,WMI 做总是不好多个服务依存而且还必须是xp 以上,里面的CommandLine_API 哪位帮忙写一下!急用
http://mvps.org/win32/processes/remthread.html