简体   繁体   中英

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM