Process.Start finished with exit code 1

25 Views Asked by At

`Start.Process always returns 1 instead 0. I am not getting where is an issue. It is calling the start process with some arguments specified below. I have checked it online about the exit code status. Exit Code says that cannot access subdirectory. Is there any access issue? Where can see the subdirectory? Exit status: 0 if OK,

   1      if minor problems (e.g., cannot access subdirectory),

   2      if serious trouble (e.g., cannot access command-line argument).`

** Here is the code **

 public string StartProcess()
 {
     string Params = "delete  -h <SERVERNAME> -u admin -p admin -f HelperFolder -G Fed -i WHERE DOKUMENTID = '4A6B22CE-E921-4AC6-8833-8ADEF9898B8F'"; //Arguments
     Process MyProces = new Process();
     ProcessStartInfo startInfo = new ProcessStartInfo();
     string Resp;
     startInfo.FileName = "C:\bin\arsdoc.exe";
     startInfo.Arguments = Params;
     startInfo.CreateNoWindow = true;
     startInfo.UseShellExecute = false;
     //startInfo.Verb = "open";
     MyProces.StartInfo = startInfo;
     MyProces.Start();
     MyProces.WaitForExit();

     Resp = MyProces.ExitCode.ToString();

     Console.WriteLine("MyProces.ExitCode: " + MyProces.ExitCode);

     return Resp;
 }

The above code calling the .exe file with arugments. What am I doing wrong?

0

There are 0 best solutions below