我做的继承类的代码是这样的,请指点
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Diagnostics;
using System.IO;
namespace ClassLibrary1
{
[RunInstaller(true)]
public partial class Installer1 : Installer
{
public Installer1()
{
InitializeComponent();
}
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver); //调整后,这句放在了上面
Process p = new Process();
p.StartInfo.RedirectStandardOutput = false;
// p.StartInfo.FileName = @"mybat.exe";
p.StartInfo.FileName = @"C:\Program Files\营收系统\update.bat"; //这样只后到是能找到批处理文件了
p.StartInfo.UseShellExecute = true;
p.Start();
p.WaitForExit();
p.Dispose();
}
}
}
//这就是想实现运行这个批处理文件,现在使用绝对路径,能找到这个批处理文件,我想请教,如何直接定位于当前系统安装的路径,这个批处理就在项目所在的目录中。还有一点,虽然找到了这个批处理文件,也运行了,但是批处理中要执行的两个命令文件却找不到。如果直接手动运行这个批处理是没有问题的,下面是批处理的内容:
@ECHO OFF
sn -Vr DevExpress.Data.v7.2.dll
gacutil /i DevExpress.Data.v7.2.dll
sn -Vr DevExpress.Utils.v7.2.dll
gacutil /i DevExpress.Utils.v7.2.dll
我做的继承类的代码是这样的,请指点
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Diagnostics;
using System.IO;
namespace ClassLibrary1
{
[RunInstaller(true)]
public partial class Installer1 : Installer
{
public Installer1()
{
InitializeComponent();
}
public override void Install(System.Collections.IDictionary stateSaver)
{
Process p = new Process();
p.StartInfo.RedirectStandardOutput = false;
p.StartInfo.FileName = @"mybat.exe";
p.StartInfo.UseShellExecute = true;
p.Start();
p.WaitForExit();
p.Dispose();