关闭 Windows 的 Exe 程序?

Exe program that shutdown Windows?

我想制作一个可关闭的 exe 应用 Windows。它用于从 McMyAdmin 2 启动它。我该怎么做? (我已经尝试制作此应用程序 (Shutdown Visual Studio Project and EXE),但我收到此错误:

The system cannot find the file specified
   at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
   at McMyAdmin.TimedEvents.DoExec(String EventData, Boolean SendToConsole, String Args)

你能帮帮我吗? 谢谢! 哈维尔

"I want to make an exe app that shutdown Windows."  

这些代码示例(Linux Windows。)是下面 link 中的基本示例。您将不得不考虑这些程序需要以足够的权限执行,以及其他一些事情才能让它们按照您的意愿工作...

在Windows中:

EDIT(标签从 C 更改为 C#

C# - 您可以将它与任何 Windows 实用程序一起使用:

Process.Start("application.exe", "param1 param2");

例如

Process.Start("c:\windows\system32\shutdown.exe", "/s");

对于 ANSI C -

#include <stdio.h> 
#include <stdlib.h> 

int main(void) 
{ 
  system("c:\windows\system32\shutdown /s"); //simple shutdown
  return 0; 
} 

其他命令:

system("c:\windows\system32\shutdown /i"); //shutdown with GUI
system("c:\windows\system32\shutdown /r"); //Restart  
system("c:\windows\system32\shutdown /l"); //Logoff
Note: These Windows shutdown commands may bring up a dialog
box requiring user to enter PC name.  If you want to automate   
populating the dialog box, command switches will help:
  Open a cmd prompt in Windows and type "help shutdown" to get this information

更多信息here