在c#中重启计算机

编程入门 行业动态 更新时间:2024-10-24 12:20:56
本文介绍了在c#中重启计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好。 这是我的代码: ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName =cmd.exe; startInfo.Arguments = string.Format(@shutdown -r -m \\ {0},txtIP.Text); Process.Start(startInfo); 我想通过此代码重新启动计算机,但我的项目无法运行。 谢谢

Hi all. this is my Code : ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = "cmd.exe"; startInfo.Arguments = string.Format(@"shutdown -r -m \\{0}", txtIP.Text); Process.Start(startInfo ); I want to restart computer by this code but my project can not be run . thanks

推荐答案

您可能希望以管理员身份运行此程序。 除此之外,我没有看到任何重大问题。 您是否面临运行此代码的某种问题? You may want to running this program as administrator. Other than that, I don't see any major issues. Are you facing some kind of issue running this code?

为什么要使用命令?关机是一个自己的过程。查看更多信息: 关闭,重新启动,注销或使用C#锁定计算机 [ ^ ] 祝你好运! Why use command? shutdown is a process of its own. Check this out for more info: Shut Down, Restart, Log off or Lock your computer in C#[^] Good luck!

以下链接可能对您有帮助: ------------------------- ------------- 1> 关闭,重启,注销或锁定您的C#中的计算机 [ ^ ] 2> stackoverflow/问题/ 15955084 / how-do-i-restart-computer-using-c-sharp-on-ec2-ubuntu-server [ ^ ] Following link may Helpful to you : -------------------------------------- 1> Shut Down, Restart, Log off or Lock your computer in C#[^] 2> stackoverflow/questions/15955084/how-do-i-restart-computer-using-c-sharp-on-ec2-ubuntu-server[^]

更多推荐

在c#中重启计算机

本文发布于:2023-11-02 13:50:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1552570.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重启计算机

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!