One problem is that your path name contains blank spaces. You need to get such path names in quotation marks. Another problem: I don't see batch file name. The name "
Software_423_303044_V0_10
" looks wrong. It can be some different file or directory name; or a batch name, but where is ".bat"?
It should look like this:
string pathName =
@"""G:\Projects\FEIN LIION\Documents Fien Lion\Documents\FEIN Akku_LiION_S3515\MyBatchFile.bat""";
Absolute path is bad! How such thing is supposed to be portable even from one computer to another. The path should be absolute at the moment of the call to
Process.Start
but never hard-coded. Is should always be calculated based on configuration parameters, or the location of entry assembly or both. There are practically no such cases when a hard-coded file name could work.
Immediate constants is evil, in general. Use explicit constants, explicit read-only properties of, resource values or… variables, data read from configuration files. For example, using "" like you do is bad, you should use
system.Empty
.
Your exception can be somewhere else. What's the use of reporting exception problem if you do not provide exception stack with code line numbers, along with corresponding part of code? Use debugger to point out exact line of offending code and indicate it in your code sample.
—SA