Asp.Net中调用win32系统内核功能的实现方法

调用win32系统内核主要就是用到Process类,使用时应该包括以下命名空间

using System.IO;
using System.Diagnostics;

以下代码的功能就是利用windows自带的发消息功能向一台目标机发送一条消息:

   Process p=new Process();
   p.StartInfo.FileName="cmd.exe";
   p.StartInfo.UseShellExecute=false;
   p.StartInfo.RedirectStandardInput = true;
   p.StartInfo.RedirectStandardOutput=true;
   p.StartInfo.RedirectStandardError=true;
   p.StartInfo.CreateNoWindow=true;
   p.Start();
   p.StandardInput.WriteLine("net send  127.0.0.1 'QQQQ'");
   p.StandardInput.WriteLine("exit");
   p.StandardOutput.ReadToEnd();
   p.Close();

posted @ 2005-10-21 13:43  小小点  阅读(182)  评论(0编辑  收藏  举报