C#中用于控制Windows系统关闭、重新启动和注销的技术。
来源:http://www.tudoupe.com时间:2021-11-18
C# 如何控制Windows 系统的例子被关闭、重新启动和注销,下文为方便起见提供。具体分析如下:
使用.NET和C#.NET, 我们可以关闭,重新启动, 并取消目前的PC。
命名空间系统。 NET Flaimwerk 中的诊断师具备从目前的 PC.NET 应用程序中完成这些行动所需的类型和方法。
要关闭、重新启动和注销,请单击下面的按钮。
这是一个双形软件。
//SHUT DOWN protected void btnShutDown_Click(object sender, EventArgs e) { Process.Start("shutdown.exe", "-s"); // By Default the Shutdown will take place after 30 Seconds //if you want to change the Delay try this one Process.Start("shutdown.exe","-s -t xx"); //Replace xx with Seconds example 10,20 etc } //RESTART protected void btnRestart_Click(object sender, EventArgs e) { Process.Start("shutdown.exe", "-r"); // By Default the Restart will take place after 30 Seconds //if you want to change the Delay try this one Process.Start("shutdown.exe","-r -t 10"); //Replace xx with Seconds example 10,20 etc } // LOG OFF protected void btnLogOff_Click(object sender, EventArgs e) { Process.Start("shutdown.exe", "-l"); //This Code Will Directly Log Off the System Without warnings }
本文件提出的C#方案设计被认为是有用的。
相关新闻
- 2022-08-04 WPF的由来
- 2022-08-04 Win11勒索软件防护怎么打开?Win11安
- 2022-08-04 Windows系统jdk的配置
- 2022-08-04 Windows10 OneNote怎么重新登录?如何重
- 2022-08-04 超好用的 Windows 效率工具推荐
- 2022-08-04 Windows如何在CMD或PowerShell中配置代理
- 2022-08-04 powershell和cmd对比
- 2022-08-04 【QT】Windows下QT下载安装
- 2022-08-04 windows下 C++ 实现类属性的get和set方
- 2022-08-04 Win11快速助手在哪里?Win11打开快速
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
