Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Keeping command prompt window displayed after i ru

Author  Topic 

rtutus
Aged Yak Warrior

522 Posts

Posted - 2007-01-11 : 22:38:20
My need: Keeping command prompt window displayed after i run System.Diagnostics.Process.Start("cmd.exe", "gacutil commad string here")

Hi I run the gacutil cmd in a C# project using

System.Diagnostics.Process.Start("cmd.exe", " gacutil commad string here");
But I want my cmd prompt black window to stay displayed in order to see the results of my code while it s runing or whie the cmd prompt finishes runing.

If that s not possibke, how do i get the result whether my cmd succeded or not.

Thanks a lot.

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-01-11 : 23:10:16
you can catch the output this way:


System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = path_to_exe;
p.StartInfo.Arguments = args_to_exe;
p.StartInfo.WorkingDirectory = working_directory;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
string output = p.StandardOutput.ReadToEnd(); // your output is here now
p.WaitForExit();




www.elsasoft.org
Go to Top of Page

rtutus
Aged Yak Warrior

522 Posts

Posted - 2007-01-18 : 09:35:22
works perfectly jezemine thank you
Go to Top of Page
   

- Advertisement -