简体   繁体   English

在C#中使用shutdown.exe关闭另一个系统?

[英]Shutdown another System using shutdown.exe in C#?

I use the following code for shutdown the own System.It was working Fine.And I need to shut down another System, which is connected in LAN Connection . 我使用以下代码关闭自己的System.It工作正常。我需要关闭另一个系统,它连接在LAN连接 I'm unable to do it with this code. 我无法使用此代码执行此操作。 How to Shutdown another System using shutdown.exe? 如何使用shutdown.exe关闭另一个系统? My OS is windows7. 我的操作系统是windows7。

using System.Diagnostics;


        protected void Button1_Click(object sender, EventArgs e)
        {
            Process.Start("shutdown.exe", "-s -t 00");

        }

Menu Start->Run->type cmd-> press enter 菜单开始 - >运行 - >键入cmd->按enter键

in cmd type 在cmd类型

shutdown /?

You can see help, according to help the key you need is 你可以看到帮助,根据帮助你需要的钥匙

   /m \\computer Specify the target computer.

只是为了完整性:

Process.Start("shutdown.exe", "-s -t 00 \\computer");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM