C# .bat file execution with Error & Output redirection

后端 未结 1 1163
我寻月下人不归
我寻月下人不归 2021-01-26 18:54

I have a .bat file to be executed.

Inside that .bat file, at its end is that code

START _file_creator.bat %some_arg_name%
ENDLOCAL
EXIT


        
相关标签:
1条回答
  • 2021-01-26 19:34

    Try setting the working directory correctly or make sure that _file_creator.bat is somewhere in the PATH. See the documentation about the working directory in conjunction with UseShellExecute:

    The WorkingDirectory property behaves differently depending on the value of the UseShellExecute property. When UseShellExecute is true, the WorkingDirectory property specifies the location of the executable. If WorkingDirectory is an empty string, it is assumed that the current directory contains the executable.

    When UseShellExecute is false, the WorkingDirectory property is not used to find the executable. Instead, it is used only by the process that is started and has meaning only within the context of the new process. When UseShellExecute is false, the FileName property must be a fully qualified path to the executable.

    0 讨论(0)
提交回复
热议问题