Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在静默安装程序中调用installer.ini参数?_C#_Visual Studio 2012 - Fatal编程技术网

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”