Shutdown a remote computer connected in LAN in any preferable language

后端 未结 7 2146
逝去的感伤
逝去的感伤 2021-01-21 19:29

I want to shut down a remote Windows computer (ex. a Windows computer connected in LAN.) I have tried a lot but I could not find the solution. Does anyone have an idea on how to

7条回答
  •  半阙折子戏
    2021-01-21 20:32

    Assuming a windows box.

    In VB.NET or c#

    Process.Start("shutdown","-s -m \\Machine");
    

    Should do the trick.

    See
    http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx
    http://www.ss64.com/nt/shutdown.html

    EDIT: Note - shutdown.exe was only available in Resource Kits prior to Windows 2003

提交回复
热议问题