Extract and Run .BAT command in C#.NET
-
יום שני 20 אוגוסט 2012 18:22
Hi,
I have a Windows Installer File i.e. BAT file which consist of DOS command.I want to run 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.msiin notepad.
Can anyone explain me how to extract and install driver from BAT file.
Thanks.
Rushabh
כל התגובות
-
יום שלישי 21 אוגוסט 2012 06:52
Why do you want to "extract DOS commands from BAT file"? Can't you simply run the BAT file? What do you currently do? What doesn't work?
-
יום רביעי 22 אוגוסט 2012 05:43
Hi Rushabh,
I have noticed you have posted the same topic on StackOverflow. And some of experts in this field has provided some soluations for you. Does you solve your problem within this way?
I feel the following solution mentioned in http://stackoverflow.com/questions/12044784/how-to-run-output-from-the-batch-file-in-c-net is suitable for your needs.
ProcessStartInfo psi = new ProcessStartInfo(<your batch file path>); Process proc = new Process(); proc.StartInfo = psi; proc.Start();
Hope it helps you.
orichisonic http://blog.csdn.net/orichisonic If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
- הוצע כתשובה על-ידי Jason Dot WangMicrosoft Contingent Staff, Moderator יום רביעי 22 אוגוסט 2012 05:44
- סומן כתשובה על-ידי ShahRushabh יום רביעי 22 אוגוסט 2012 16:32