我有以下代码来抓取计划任务,虽然我无法将它们输出到文本框中:
private void button22_Click(object sender, EventArgs e)
{
var query = new ManagementObjectSearcher("SELECT * FROM Win32_ScheduledJob");
var tasks = query.Get();
richTextBox6.Text = ManagementObjectSearcher.ToString();
}
答案 0 :(得分:2)
试试这个
var query = new ManagementObjectSearcher("SELECT * FROM Win32_ScheduledJob");
var tasks = query.Get();
foreach (ManagementObject task in tasks)
{
richTextBox6.Text += Environment.NewLine + task["Description"]
}
答案 1 :(得分:0)
foreach (ManagementObject task in tasks)
{
Console.WriteLine(task.GetPropertyValue("Description"));
}
从here获取属性