I am trying to install a Windows Installer File i.e. BAT file which consist of DOS command.I want to run BAT file and extract DOS command from BAT file and re-run the DOS command, in order, to install proper driver. I did search a lot but I couldn’t able to get solution for that. I am able to run .exe file.
here is my code –
ProcessStartInfo aProcessInfo;
Process aProcess = new Process();
aProcessInfo = new ProcessStartInfo(command);
aProcessInfo.UseShellExecute = false;
aProcessInfo.RedirectStandardOutput = true;
aProcessInfo.RedirectStandardError = true;
aProcessInfo.CreateNoWindow = true;
aProcess = Process.Start(aProcessInfo);
aProcess.WaitForExit();
My BAT file is install.bat; which when I click on edit open DOS command like
cls
msiexec /quiet /passive /i lcild_v207230.msi
in notepad.
Can anyone explain me how to extract and install driver from BAT file.
Thanks.
Ok then, this one just pops-up in my head. You can read the BAT file as a text file using File.Read or StreamReader class and then read the line that has the actual installation command i.e. the line with msiexec and then use your ProcessStartInfo class to start “msiexec”. Make sure to pass whatever parameters that command needs, obviously a file name. See if that works.