Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想通过以下命令关闭电脑:
Process.Start("shutdown", string.Format(@"/s /t "+textBox1.Text+" /m \\{0}", txtPC.Text));
但它不会从 textbox1 返回计时器的值。
我认为您想要这样的东西(@不适用于包含的第二个字符串文字\\,编译器会将其解释为单个\)
@
\\
\
string.Format(@"/s /t {0} /m \\{1}", textBox1.Text, txtPC.Text);