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

时间:2020-12-16 12:16:21

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. I'm unable to do it with this code. How to Shutdown another System using shutdown.exe? My OS is windows7.

我使用以下代码关闭自己的System.It工作正常。我需要关闭另一个系统,它连接在LAN连接。我无法使用此代码执行此操作。如何使用shutdown.exe关闭另一个系统?我的操作系统是windows7。

using System.Diagnostics;


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

        }

2 个解决方案

#1


1  

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.

#2


1  

Just for completeness:

只是为了完整性:

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

#1


1  

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.

#2


1  

Just for completeness:

只是为了完整性:

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