如何启用禁用msconfig启动程序 [英] How to enable disable msconfig startup programs

查看:194
本文介绍了如何启用禁用msconfig启动程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此代码来获取启动程序列表.如何在C#代码中启用和禁用它.

I am using this code to get list of startup program. how to make it enable and disable in c# code.

private void getStartupItems()
{    
       List<String> ItemName = new List<String>();
       List<String> ItemCommand = new List<String>();
       List<String> ItemDescription = new List<String>();
       List<String> ItemLocation = new List<String>();
       List<String> ItemUser = new List<String>();

    try
    {
        ManagementClass cls = new ManagementClass("Win32_StartupCommand");
        ManagementObjectCollection coll = cls.GetInstances();
        List<string> items = new List<string>();

        foreach (ManagementObject obj in coll)
        {
            String Name = obj["Name"].ToString();
            ItemName.Add(Name);
            listBox3.Items.Add(Name);
            String Command = obj["Command"].ToString();
            ItemCommand.Add(Command);
                
            String  Description = obj["Description"].ToString();
            ItemDescription.Add(Description);
                
            String  Location = obj["Location"].ToString();
            ItemLocation.Add(Location);
            String User = obj["User"].ToString();
            ItemUser.Add(User);
        }
       // return items;
    }
    catch (Exception ex)
    {
        //_message = ex.ToString();
        //_status = false;
       // return null;
    }
}

推荐答案



您是否检查过 [
Hi,

have you check this[^] discussion ?

hope it works for you.


这篇关于如何启用禁用msconfig启动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆