Akash Dani

Akash Dani

  • NA
  • 87
  • 25.4k

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 = "\\\\172.16.10.111\\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");
p.Start();
p.WaitForExit();
Write("BatchFile: WaitForExit() Execution Ended");
p.Dispose();
 
My Batch File Code:
 
set _p= %-p%
sdelete _p 7 \172.16.10.111\StarRECON2\StarRecon\Files\Extraction\Files\UBETSW04062018.CSV

Answers (8)