<div class="votecount">Hi</div> <div class="container"> <div class="body">
I have the following piece of code that I am trying to run from a windows service to execute a batch file. But its not running. Can someone help me in finding out whats wrong with it. There is no error but the batch file does not run.
Thanks
string BatchPath = ConfigurationManager.AppSettings["BatchPath1"]; System.Diagnostics.Process proc = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(BatchPath); info.UseShellExecute = false; info.RedirectStandardError = true; info.RedirectStandardInput = true; info.RedirectStandardOutput = true; info.CreateNoWindow = false; info.ErrorDialog = true; info.WindowStyle = ProcessWindowStyle.Normal; proc.StartInfo = info; proc.Start(); System.Threading.Thread.Sleep(10000); // simulate doing other things... proc.StandardInput.WriteLine("exit"); // tell console to exit</div> </div>