Click here to Skip to main content
15,920,704 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hello Please Help me i am getting error
her is my code

public string RunExternalExe(string filename, string arguments = null)
           var process = new Process();

           process.StartInfo.FileName = filename;
           if (!string.IsNullOrEmpty(arguments))
               process.StartInfo.Arguments = arguments;

           process.StartInfo.CreateNoWindow = true;
           process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
           process.StartInfo.UseShellExecute = false;

           process.StartInfo.RedirectStandardError = true;
           process.StartInfo.RedirectStandardOutput = true;
           var stdOutput = new StringBuilder();
           process.OutputDataReceived += (sender, args) => stdOutput.Append(args.Data);

           string stdError = null;
              // process.Start("rtmpdump.exe");
               System.Diagnostics.Process.Start("rtmpdump", filename);
              // Process.Start(filename);
               stdError = process.StandardError.ReadToEnd();
           catch (Exception e)
               throw new Exception("OS error while executing " + Format(filename, arguments) + ": " + e.Message, e);

           if (process.ExitCode == 0 || process.ExitCode == 2)
               string yes = "yes";

               return yes;

               return "no";

       private static string Format(string filename, string arguments)
           return "'" + filename +
               ((string.IsNullOrEmpty(arguments)) ? string.Empty : " " + arguments) +
Updated 28-Jul-20 22:52pm

have solved m problem

string currentLocation = AppDomain.CurrentDomain.BaseDirectory;
           string[] s=  currentLocation.Split('b');
           string final = s[0] +"b"+ s[1] +"b"+ s[2];

         string rtmpDump = Path.Combine(final, "Tool\\Rtmpdump\\rtmpdump.exe");
Share this answer
Two things:
1) check that "rtmpdump" is installed, available, and on the system path: open a command prompt and type "rtmpdump" and press ENTER. Does it run? I suspect not...
2) why do you crest a Process instance, and then totally ignore it?
Share this answer
[no name] 14-Nov-13 2:24am    
yes you are right please read my above comment?
Hi Lakhan,

The error occurs in System.Diagnostics.Process.Start("rtmpdump", filename); line?
If it so then the file you are trying to access from the path is not valid as the error itself is self descriptive.....

Suggestion: Check for the file in the path manually through explorer.
I think c# code wont blame you unnecessarily ;-)

Hope this helps you a bit.

Share this answer
[no name] 14-Nov-13 2:23am    
yes you are right but how to get path this my current path how to get this path using code.....
C:\Users\Om\Documents\Visual Studio 2010\Projects\Multimedia URL Probe 1.0\Multimedia URL Probe 1.0\Tool\Rtmpdump\rtmpdump.exe

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900