Process.Start() method throwing "The system cannot find the file specified" Error while loading data to Database. RRS feed

  • Question

  • am trying to load some records into Dtabase by using .BAT, .CTL and .DAT fiels. Below code i have created and it is not working and throwing following error message when control comes process.Start() method.

    Actually, Bat, ctl and Data fiels are exixts in same directory. I am sure there is no issue with the data and code in these files.

    It would be very helpful if we get solution.

    ERROR: The system cannot find the file specified

    Stact trace:    at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
       at System.Diagnostics.Process.Start()
       at ConsoleApplication3.Program.createHeader1(String hdr1Path, String environment)


    private static void createHeader1(string hdr1Path, string environment)




                    ProcessStartInfo ProcessInfo;

                    Process p;

                    ProcessInfo = new ProcessStartInfo();

                    ProcessInfo.FileName = "qaheader1_1600.bat";

                    ProcessInfo.WindowStyle = ProcessWindowStyle.Hidden;

                    ProcessInfo.WorkingDirectory = Path.GetDirectoryName(hdr1Path);

                    ProcessInfo.UseShellExecute = false;

                    p = new Process();

                    p.StartInfo = ProcessInfo;





                catch (Exception ex)





    Friday, December 16, 2016 1:51 PM

All replies

  • Hi Balaji Dj,

    Please use the following code instead. I've tested on my side, it works fine.


    By the way, based on your code, I haven't seen any where use parameter environment, you can remove it.

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Edited by Kristin Xie Monday, December 19, 2016 2:33 AM
    • Proposed as answer by Kristin Xie Friday, December 23, 2016 2:35 AM
    Monday, December 19, 2016 2:30 AM