Use C # to install a program in silent mode by passing parameters

1

I'm trying to create a program that silently installs multiple programs

Some programs that use simple "/ Q" parameters I got and worked out.

but has a program that the parameter is large and can not solve

I can not set a fixed path because I want my program to work in any directory or folder

The command is this: vcredist_x86.exe / q: a /c:"VCREDI~1.EXE / q: a / c: "msiexec / i vcredist.msi / qn" ""

via cmd install perfectly, just can not do this via c #

I've tried several ways but with no success, an example of a way I did not work:

ProcessStartInfo startInfo = new ProcessStartInfo()
{
    string pathApp = "Visual C++05\vcredist_x86.exe";
    FileName = Path.Combine(Environment.CurrentDirectory, pathApp),
    Arguments = " /q:a /c:\"VCREDI~1.EXE / q:a / c:\"\"msiexec / i vcredist.msi / qn\"\" \"",
    WorkingDirectory = Environment.CurrentDirectory,
    WindowStyle = ProcessWindowStyle.Hidden,
    UseShellExecute = true
};

using (Process exeProcess = Process.Start(startInfo))
{
    exeProcess.EnableRaisingEvents = true;
    exeProcess.WaitForExit(60000);
}

The error that he says that the file was not found or he starts to install showing on the screen without being silent, as if he had ignored the parameter

OBS : I tried several variations of this code, passing the complete path of the program, tried to create a bat and run the bat but tbm did not give

What am I doing wrong?

    
asked by anonymous 24.08.2018 / 22:30

1 answer

1

Resolved

I discovered the problem, the visual studio was trolling me, every time I pasted the txt it gave space alone so the argument was incorrect

I then got all the extra space he put in and it worked.

example: I copied this "/ c:" and it looked like this: "/ c:"

    
27.08.2018 / 04:07