C# 如何在静默安装程序中调用installer.ini参数?
我使用此代码在静默模式下安装程序:C# 如何在静默安装程序中调用installer.ini参数?,c#,visual-studio-2012,C#,Visual Studio 2012,我使用此代码在静默模式下安装程序: private void Install_Click(object sender, EventArgs e) { string path = AppDomain.CurrentDomain.BaseDirectory.ToString(); string configfilename = path + "config.ini"; string installerfil
private void Install_Click(object sender, EventArgs e)
{
string path = AppDomain.CurrentDomain.BaseDirectory.ToString();
string configfilename = path + "config.ini";
string installerfilename = path + "installer.ini";
string configtext = File.ReadAllText(configfilename);
string installertext = File.ReadAllText(installerfilename);
}
Process process = new Process();
process.StartInfo.FileName = @"D:\Matlab\NSIS\R2008a\win64\setup.exe";
process.StartInfo.Arguments = "/quiet";
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.Start();
process.WaitForExit();
}
但是这段代码使setup.exe运行,但是没有使用installer.ini,在那里我有许可证
编号,outlog
编号…我如何做到这一点,使用installer.ini
的参数作为Matlab程序的静默安装程序
我也试过这个:
Process process = new Process();
process.StartInfo.FileName = @"D:\Matlab\NSIS\R2008a\win64\setup.exe";
process.StartInfo.Arguments = @"C:\temp\installer.ini";
process.StartInfo.Arguments = "/quiet";
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.Start();
process.WaitForExit();
据我所知
安装程序需要-if
键和installer.ini
文件,因此C#语法将是
// Put IDisposable into using
using (Process process = new Process()) {
// The installer itself
process.StartInfo.FileName = @"D:\Matlab\NSIS\R2008a\win64\setup.exe";
// suggested (see links above) arguments
process.StartInfo.Arguments = @"-if C:\temp\installer.ini";
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.Start();
process.WaitForExit();
}
据我所知
安装程序需要-if
键和installer.ini
文件,因此C#语法将是
// Put IDisposable into using
using (Process process = new Process()) {
// The installer itself
process.StartInfo.FileName = @"D:\Matlab\NSIS\R2008a\win64\setup.exe";
// suggested (see links above) arguments
process.StartInfo.Arguments = @"-if C:\temp\installer.ini";
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.Start();
process.WaitForExit();
}
似乎应该将installerfilename和/或configfilename作为命令行参数提供给setup.exe;看到这个东西:setup.exe-inputFile C:\temp\installer.txt我不知道怎么做这可能也会有帮助:我已经有了这个:!insertmacro ExecWaitJob“D:\Matlab\NSIS\R2008a\win64\setup.exe-如果在NSIS中是C:\temp\installer.ini”,但我不知道如何将其放入C中。据我所知,您希望执行“D:\Matlab\NSIS\R2008a\win64\setup.exe-如果是C:\temp\installer.ini”
;在C#中,它可能类似于process.StartInfo.FileName=@“D:\Matlab\NSIS\R2008a\win64\setup.exe”
和“process.StartInfo.Arguments=-if C:\temp\installer.ini”代码>似乎应该将installerfilename和/或configfilename作为命令行参数提供给setup.exe;看到这个东西:setup.exe-inputFile C:\temp\installer.txt我不知道怎么做这可能也会有帮助:我已经有了这个:!insertmacro ExecWaitJob“D:\Matlab\NSIS\R2008a\win64\setup.exe-如果在NSIS中是C:\temp\installer.ini”,但我不知道如何将其放入C中。据我所知,您希望执行“D:\Matlab\NSIS\R2008a\win64\setup.exe-如果是C:\temp\installer.ini”
;在C#中,它可能类似于process.StartInfo.FileName=@“D:\Matlab\NSIS\R2008a\win64\setup.exe”
和“process.StartInfo.Arguments=-if C:\temp\installer.ini”代码>