// 调用 AutoRegCom("regsvr32 -s dm.dll");
static string AutoRegCom(string strCmd)
{
string rInfo;
try
{
Process myProcess = new Process();
ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("cmd.exe");
myProcessStartInfo.UseShellExecute = false;
myProcessStartInfo.CreateNoWindow = true;
myProcessStartInfo.RedirectStandardOutput = true;
myProcess.StartInfo = myProcessStartInfo;
myProcessStartInfo.Arguments = "/c " + strCmd;
myProcess.Start();
StreamReader myStreamReader = myProcess.StandardOutput;
rInfo = myStreamReader.ReadToEnd();
myProcess.Close();
rInfo = strCmd + "\r\n" + rInfo;
return rInfo;
}
catch (Exception ex)
{
return ex.Message;
}
}