关闭带有文本框的PC计时器

Shut Down PC with textbox a timer [closed]
2021-06-10
  •  译文(汉语)
  •  原文(英语)

我想通过以下命令关闭电脑:

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

但是它不会从textbox1返回计时器的值.

速聊1:
你放了textBox1什么?
解决过程1

我认为您想要这样的东西(@不适用于包含的第二个字符串文字\\,编译器会将其解释为单个\)

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

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.

Talk1:
What did you put in textBox1?
Solutions1

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);
转载于:https://stackoverflow.com/questions/19080938/shut-down-pc-with-textbox-a-timer

本人是.net程序员,因为英语不行,使用工具翻译,希望对有需要的人有所帮助
如果本文质量不好,还请谅解,毕竟这些操作还是比较费时的,英语较好的可以看原文

留言回复
我们只提供高质量资源,素材,源码,坚持 下了就能用 原则,让客户花了钱觉得值
上班时间 : 周一至周五9:00-17:30 期待您的加入