C#中CMD安装程序前如何指定安装路径?

How to specify installation path before installing program with CMD in C#?

我有一个应用程序,我在其中以特定路径下载 MariaDB,然后我 运行 安装程序,但我想更改安装 MariaDB 的路径,这是我的代码与

一起工作
private void InstalarMariaDB()
    {
        try
        {
            Process proceso = new Process();
            ProcessStartInfo startInfo = new ProcessStartInfo();

            startInfo.UseShellExecute = true;
            startInfo.CreateNoWindow = true;
            startInfo.WindowStyle = ProcessWindowStyle.Hidden;
            startInfo.FileName = "cmd.exe";
            startInfo.WorkingDirectory = rutaDirectorio;
            startInfo.Arguments = "/C msiexec /i MariaDB.msi /passive";
            proceso.StartInfo = startInfo;
            proceso.Start();

        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }

我想我需要在参数行中这样做

startInfo.Arguments = "/C msiexec /i MariaDB.msi /passive";

我试过了,但没有用,因为它说参数对 msi 安装程序列表无效

Arguments = "/s /v/qn /vINSTALLDIR=\"+targetDir+"\""

希望大家能帮帮我,谢谢

这是我根据我在此处阅读的评论解决问题的方法

private void InstalarMariaDB()
    {
        try
        {
            // MSI path
            string rutaMSI = rutaDirectorio + "MariaDB.msi";
            // Installation path
            string rutaInstalacion = @"C:\Program Files (x86)\PudveBD\";
            // Service name
            string servicio = "PudveBD";
            // Args
            string argumentos = string.Format("/qn /i \"{0}\" INSTALLDIR=\"{1}\" ALLUSERS=1 PORT=6666 SERVICENAME=\"{2}\"", rutaMSI, rutaInstalacion, servicio);

            Process proceso = new Process();
            proceso.StartInfo.FileName = "msiexec.exe";
            proceso.StartInfo.Arguments = argumentos;
            proceso.StartInfo.Verb = "runas";
            proceso.Start();
            proceso.WaitForExit();
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }