string close = "at " + comboBox1.Text + ":" + comboBox2.Text + " shutdown -s";
textBox1.Text = close;
哪里错了啊?? C#字符串

解决方案 »

  1.   

    "at " + comboBox1.Text + ":" + comboBox2.Text + " \"shutdown -s\"";
      

  2.   

            private void button1_Click(object sender, EventArgs e)
            {
                Process p = new Process();//创建一个新的进程
                p.StartInfo.FileName = "cmd.exe";
                // 这里是关键点,不用Shell启动/重定向输入/重定向输出/不显示窗口
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.RedirectStandardInput = true;
                p.StartInfo.RedirectStandardOutput = true;
                p.StartInfo.CreateNoWindow = true;
                p.Start();//启动
                string close = "at " + comboBox1.Text + ":" + comboBox2.Text + " \"shutdown -s\"";
                p.StandardInput.WriteLine("close");
                string s = p.StandardOutput.ReadToEnd();// 得到cmd.exe的输出
                p.Close();        }哪里错了啊!!!无法执行关机命令
      

  3.   

    comboBox1.Text comboBox2.Text 有没有内容,是不是数字,是不是有效的时间