Forums - C# Corner

Forum guidelines
Akash Dani

Akash Dani

  • 1.8k
  • 24
  • 361

Batch file is not running properly

Jul 3 2019 7:12 AM
I have created batch file.When I run manually it working fine.But when I run using c# codes in visual studio its not working any idea about this?
I have tried all the methods
This is my code
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.RedirectStandardOutput = false;
p.StartInfo.FileName = "\\\\\\StarRECON2\\StarRECON\\Files\\Extraction\\Files" + "TESTDEL.bat";
----BatchFilePathp.StartInfo.UseShellExecute = false;
p.StartInfo.WorkingDirectory = Environment.CurrentDirectory;
p.StartInfo.RedirectStandardError = true;
Write("BatchFile: Start() Execution Started");
Write("BatchFile: WaitForExit() Execution Ended");
My Batch File Code:
set _p= %-p%
sdelete _p 7 \\StarRECON2\StarRecon\Files\Extraction\Files\UBETSW04062018.CSV

Answers (8)