简体   繁体   中英

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

in cmd type

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");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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