Question

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.

Was it helpful?

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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top