如果是这些dll都是COM组件的话,你可以使用regsvr32.exe来注册它们:
比如:
Process p=new Process();
p.StartInfo=new ProcessStartInfo("regsvr32.exe",@"c:\winnt/system32/a.dll c:\winnt/system32/b.dll c:\winnt/system32/c.dll ");
p.Start();
你可以设置参数/s不显示对话框
比如:
Process p=new Process();
p.StartInfo=new ProcessStartInfo("regsvr32.exe",@"c:\winnt/system32/a.dll c:\winnt/system32/b.dll c:\winnt/system32/c.dll ");
p.Start();
你可以设置参数/s不显示对话框
该怎么解决此问题??
能否具体一点,,,,
IF NOT EXIST c:\winnt/system32/a.dll GOTO AEND
regsvr32.exe c:\winnt/system32/a.dll
:AENDIF NOT EXIST c:\winnt/system32/b.dll GOTO BEND
regsvr32.exe c:\winnt/system32/b.dll
:BENDIF NOT EXIST c:\winnt/system32/c.dll GOTO CEND
regsvr32.exe c:\winnt/system32/c.dll
:CEND
然后再程序中调用这个文件:
Process p=new Process();
p.StartInfo=new ProcessStartInfo("ABC.BAT");
p.Start();
我读config.ini文件中的文件。可能有些.dll不能进行注册工作。
因此中断程序的执行。能否有其他方式来避免。。
using System.Diagnostics;...
string[] strArr = {@"c:\1.dll",@"c:\2.dll"};
Process p = new Process();
p.StartInfo.FileName = "regsvr32.exe";
foreach(string s in strArr)
{
p.StartInfo.Arguments = "/s " + s;
p.Start();
p.WaitForExit(); if (p.ExitCode == 0)
{
MessageBox.Show("regsvr32 " + s + " Successed");
}
else
{
MessageBox.Show("regsvr32 " + s + " Failed");
}
}
请确信你拷贝了代码,试验过了.我的那两个dll都是没有的,所以我得到了两个Failed. 如果你的还是象你说的那样,请贴上你的Code来. 有可能描述和理解总是有偏差的.