尽管无法将它们输出到文本框中,但是我有以下代码可捕获计划任务:
private void button22_Click(object sender, EventArgs e)
{
var query = new ManagementObjectSearcher("SELECT * FROM Win32_ScheduledJob");
var tasks = query.Get();
richTextBox6.Text = ManagementObjectSearcher.ToString();
}
最佳答案
试试这个
var query = new ManagementObjectSearcher("SELECT * FROM Win32_ScheduledJob");
var tasks = query.Get();
foreach (ManagementObject task in tasks)
{
richTextBox6.Text += Environment.NewLine + task["Description"]
}
关于c# - C#-让ManagementObjectSearcher输出到文本框,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6417516/