使用c#.net重新启动本地计算机 [英] rebooting the local machine using c#.net

查看:73
本文介绍了使用c#.net重新启动本地计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何?我使用c#.net重新启动计算机?


谢谢,
Shivanee.

How do ?I reboot the machine using c#.net?


Thanks,
Shivanee.

推荐答案

您好,

您可以使用Windows API.

下面是一个简短示例:
Hi,

one option would be that you use Windows API.

Here is short example:

System.Runtime.InteropServices;
[DllImport (" user32.dll" )]
public 静态 外部 int ExitWindowsEx( uFlags, dwReason);
私有 void ExitWindowsEx(2,0);
}
using System.Runtime.InteropServices; 
 
[DllImport("user32.dll")] 
public static extern int ExitWindowsEx(int uFlags, int dwReason); 
 
private void Reboot() 
    ExitWindowsEx(2, 0); 


这篇关于使用c#.net重新启动本地计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆