How I can call the installer.ini arguments in a silent installer?

送分小仙女□ 提交于 2020-01-15 20:18:31

问题


I use this code to install in silent mode a program :

 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();
}

But this code made setup.exe to run, but doesn't use the installer.ini where I have the license number, outlog number ...How I can do this, to use the arguments of installer.ini for a silent installer of Matlab program ?

Also I tried this :

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();

回答1:


As far as I understood

http://www.mathworks.com/matlabcentral/answers/106140-how-do-i-utilize-silent-activation-using-activate-ini

http://www.mathworks.com/help/install/ug/install-noninteractively-silent-installation.html

the installer wants -if key and installer.ini file, so the C# syntax will be

   // 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();
   }


来源:https://stackoverflow.com/questions/32689764/how-i-can-call-the-installer-ini-arguments-in-a-silent-installer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!