I have problem with command line window after executing bat file. I want to run bat file, without cmd window shown, close it and after all this open my PDF file which is generated using my program and bat file. My code:
Process p1 = new Process();
p1.StartInfo.FileName = @"C:\dir\batch.bat";
p1.StartInfo.Arguments = @"C: \dir\final.tex";
p1.StartInfo.UseShellExecute = false;
p1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p1.Start();
p1.WaitForExit(15*1000);
p1.Close();
Process.Start(@"C:\dir\final.pdf");
So what happens in my case: Everything runs as it should do, but my PDF is show before my bat file is doing the job. How to make my Process.Start(pdf)
wait, till my bat file will finish the job? When using p1.WaitForExit()
, I need manually exit the cmd window, I don't want to do this. Any ideas?
Thanks.
My bat file:
xelatex --output-driver="xdvipdfmx -V 7 -q" final.tex
xelatex --output-driver="xdvipdfmx -V 7 -q" final.tex
call clean.bat