Click here to Skip to main content
15,885,216 members
Home / Discussions / C#
   

C#

 
AnswerRe: how can i show google earth in winform c# Pin
Richard MacCutchan27-May-16 2:58
mveRichard MacCutchan27-May-16 2:58 
GeneralRe: anyway thank sir!i get setparent but need placemark,polygon,etc.. i m just beginner. :-O Pin
Member 1252559627-May-16 3:55
Member 1252559627-May-16 3:55 
GeneralRe: how can i show google earth in winform c# Pin
Pete O'Hanlon27-May-16 4:17
mvePete O'Hanlon27-May-16 4:17 
QuestionWhat Does Complexity of Algorithm Mean??? Pin
Django_Untaken26-May-16 0:14
Django_Untaken26-May-16 0:14 
AnswerRe: What Does Complexity of Algorithm Mean??? Pin
Richard MacCutchan26-May-16 0:18
mveRichard MacCutchan26-May-16 0:18 
AnswerINCORRECT FORUM Pin
Pete O'Hanlon26-May-16 0:20
mvePete O'Hanlon26-May-16 0:20 
GeneralRe: What Does Complexity of Algorithm Mean??? Pin
harold aptroot26-May-16 0:52
harold aptroot26-May-16 0:52 
QuestionHow to read process Output Message from process within the process ?? Pin
ArunRagam25-May-16 23:45
professionalArunRagam25-May-16 23:45 
I am running an exe through commandline and getting following output.

C#
C:\Users\sysadmin>C:\Users\sysadmin\Desktop\New_folder\Setup\PatchInstaller.exe --mode=silent


C#
C:\Users\sysadmin Begin Setup
UI mode: Silent
Error : Another instance running, Only a single instance can be run at a time.
Exit Code: 11


i am running this through System.daignostics.process.

My issue is PatchInstaller.exe calling another process and the output of that nested process is what is visible with cmd. but the same result and exit code i am not able to get through Process object of PatchInstaller.exe.
Is there any way of getting output of process running within process?
Following is the code i have tired...




C#
string command = @"C:\Users\sysadmin\Desktop\Setup\PatchInstaller.exe";
string result = string.Empty;
Exitcode = 0;
            try
            {



              
                Exitcode = 0;
                // create the ProcessStartInfo using "cmd" as the program to be run, and "/c " as the parameters.
                // Incidentally, /c tells cmd that we want it to execute the command that follows, and then exit.
                System.Diagnostics.ProcessStartInfo procStartInfo = new ProcessStartInfo();
procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command + " --mode=silent);
                System.Diagnostics.Process proc = new Process();
// The following commands are needed to redirect the standard output. 
//This means that it will be redirected to the Process.StandardOutput StreamReader.
procStartInfo.ErrorDialog = false;
                procStartInfo.UseShellExecute = false;
                procStartInfo.RedirectStandardOutput = true;
                procStartInfo.RedirectStandardError = true;
                

                procStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                // Do not create the black window.
                procStartInfo.CreateNoWindow = true;

                if (!string.IsNullOrEmpty(domain) && !string.IsNullOrEmpty(user) && !string.IsNullOrEmpty(pwd))
                {
                    procStartInfo.Domain = domain;
                    procStartInfo.UserName = user;

                    System.Security.SecureString ss = new System.Security.SecureString();
                    foreach (char c in pwd) { ss.AppendChar(c); }
                    procStartInfo.Password = ss;
                }


                // Now we create a process, assign its ProcessStartInfo and start it
                proc = System.Diagnostics.Process.Start(procStartInfo);
              
                proc.ErrorDataReceived += delegate(object sender, System.Diagnostics.DataReceivedEventArgs errorLine)
                {
                    if (errorLine.Data != null) result += "error:" + errorLine.Data + "\r\n";

                };
                proc.OutputDataReceived += delegate(object sender, System.Diagnostics.DataReceivedEventArgs outputLine)
                {
                    if (outputLine.Data != null) result += outputLine.Data + "\r\n";

                };
                proc.BeginErrorReadLine();
                proc.BeginOutputReadLine();
                Process[] pname = Process.GetProcessesByName("AdobePatchInstaller");
Process[] processlist = Process.GetProcesses();
                foreach (Process theprocess in processlist)
                {
                    Console.WriteLine("Process: {0} ID: {1}", theprocess.ProcessName, theprocess.Id);
                }

                proc.WaitForExit();
            }

            catch (Exception ex)
            {
                throw (ex);
            }

            return result;


modified 26-May-16 6:06am.

QuestionAdvice needed Pin
osxman25-May-16 10:14
osxman25-May-16 10:14 
AnswerMessage Closed Pin
25-May-16 10:55
rickrose050625-May-16 10:55 
GeneralRe: Advice needed Pin
CHill6025-May-16 10:56
mveCHill6025-May-16 10:56 
GeneralRe: Advice needed Pin
OriginalGriff25-May-16 19:38
mveOriginalGriff25-May-16 19:38 
GeneralRe: Advice needed Pin
osxman25-May-16 21:50
osxman25-May-16 21:50 
GeneralRe: Advice needed Pin
Pete O'Hanlon25-May-16 21:56
mvePete O'Hanlon25-May-16 21:56 
GeneralRe: Advice needed Pin
OriginalGriff25-May-16 22:04
mveOriginalGriff25-May-16 22:04 
GeneralRe: Advice needed Pin
osxman25-May-16 22:12
osxman25-May-16 22:12 
GeneralRe: Advice needed Pin
OriginalGriff25-May-16 22:17
mveOriginalGriff25-May-16 22:17 
GeneralRe: Advice needed Pin
osxman25-May-16 22:31
osxman25-May-16 22:31 
GeneralRe: Advice needed Pin
Richard Deeming26-May-16 1:58
mveRichard Deeming26-May-16 1:58 
GeneralRe: Advice needed Pin
rickrose050626-May-16 3:11
rickrose050626-May-16 3:11 
GeneralRe: Advice needed Pin
Mycroft Holmes26-May-16 14:36
professionalMycroft Holmes26-May-16 14:36 
AnswerRe: Advice needed Pin
Garth J Lancaster26-May-16 0:10
professionalGarth J Lancaster26-May-16 0:10 
AnswerRe: Advice needed Pin
F-ES Sitecore26-May-16 0:16
professionalF-ES Sitecore26-May-16 0:16 
AnswerRe: Advice needed Pin
Gerry Schmitz26-May-16 7:13
mveGerry Schmitz26-May-16 7:13 
QuestionConvert Pin
Bakeel25-May-16 9:36
Bakeel25-May-16 9:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.