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.
我正在使用 Ubuntu 在 AWS EC2 实例上运行 C# 控制台应用程序。我想使用 C# 从我的应用程序重新启动计算机。有什么方法可以sudo reboot从 C# 执行吗?
sudo reboot
提前致谢。
它使用以下代码工作。
Process process = new Process(); process.StartInfo.FileName = "/usr/bin/sudo"; process.StartInfo.Arguments = "/sbin/shutdown -r now"; process.Start();