Search code examples
c#shutdown

Shut Down PC with textbox a timer


I want to shutdown pc by following command:

Process.Start("shutdown", string.Format(@"/s /t "+textBox1.Text+" /m \\{0}", txtPC.Text));

But it doesn't return the value for timer from textbox1.


Solution

  • I think you want something like this (@ doesn't apply to the second string literal containing \\ and it will be interpreted by the compiler as a single \)

    string.Format(@"/s /t {0} /m \\{1}", textBox1.Text, txtPC.Text);