通过WMI获取启动列表
如何获取完整的 .exe 路径
让我们假设使用以下字符串 strt["Command"].ToString(); 我得到这个输出
C:\Program Files\模拟 Devices\SoundMAX\soundmax.exe /tray
但如何获取
C:\Program Files\模拟 设备\SoundMAX\soundmax.exe
ManagementClass mangnmt = new ManagementClass("Win32_StartupCommand");
ManagementObjectCollection mcol = mangnmt.GetInstances();
foreach (ManagementObject strt in mcol)
{
string[] lv = new String[4];
lv[0] = strt["Caption"].ToString();
lv[1] = strt["Location"].ToString();
lv[2] = strt["Command"].ToString();
lv[3] = strt["Description"].ToString();
listView1.Items.Add(new ListViewItem(lv, 0));
}
How do I gat the the full .exe path
Let us assume with the following string strt["Command"].ToString();
I get this output
C:\Program Files\Analog
Devices\SoundMAX\soundmax.exe /tray
but how to I get
C:\Program Files\Analog
Devices\SoundMAX\soundmax.exe
ManagementClass mangnmt = new ManagementClass("Win32_StartupCommand");
ManagementObjectCollection mcol = mangnmt.GetInstances();
foreach (ManagementObject strt in mcol)
{
string[] lv = new String[4];
lv[0] = strt["Caption"].ToString();
lv[1] = strt["Location"].ToString();
lv[2] = strt["Command"].ToString();
lv[3] = strt["Description"].ToString();
listView1.Items.Add(new ListViewItem(lv, 0));
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)