batch file execution in c#

后端 未结 4 750
南笙
南笙 2021-01-20 12:43

I am running a Java batch file from C#. If I run it by double clicking it executes successfully, but if I run it from C# code it gives exception in thread

4条回答
  •  逝去的感伤
    2021-01-20 13:32

    Do not use batch_process_path + "\" + instead use Path.Combine() to make sure the path is correctly fitted with slashes.

    Also read this "When UseShellExecute is true, the WorkingDirectory property specifies the location of the executable"

    So set it to false.

提交回复
热议问题