call cmd processes and keeping them cmd window

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2007
Posts: 10
Reputation: GRaymer is an unknown quantity at this point 
Solved Threads: 1
GRaymer GRaymer is offline Offline
Newbie Poster

call cmd processes and keeping them cmd window

 
0
  #1
Oct 19th, 2007
I've been able to call a cmd process to run a batch file. It runs but I have no idea what it does bec' the window opens and closes too fast. I've used .WaitForExit(), but it doesn't help. I've been looking for more help and can find anything specific. I can't tell if my batch file runs or not and where the output redirects too. Any help would be greatly appreciated. Thanks.

Gabe
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: call cmd processes and keeping them cmd window

 
0
  #2
Oct 19th, 2007
You remind me with graduation project days

  1. public void GenerateKeyFile(string command)
  2. {
  3. ProcessStartInfo PSI = new ProcessStartInfo("cmd.exe");
  4. PSI.RedirectStandardInput = true;
  5. PSI.RedirectStandardOutput = true;
  6. PSI.RedirectStandardError = true;
  7. PSI.UseShellExecute = false;
  8. Process p = Process.Start(PSI);
  9. System.IO.StreamWriter SW = p.StandardInput;
  10. System.IO.StreamReader SR = p.StandardOutput;
  11. SW.WriteLine(command);
  12. SW.Close();
  13. }
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 20
Reputation: tostrinj is an unknown quantity at this point 
Solved Threads: 1
tostrinj's Avatar
tostrinj tostrinj is offline Offline
Newbie Poster

Re: call cmd processes and keeping them cmd window

 
0
  #3
Oct 26th, 2007
ok, quick and dirty, to be removed before building release - used to help me in my student years. Last line of code is :
Console.ReadLine();

that will wait until you kill the console.
===========================
can you repeat the part of the stuff where you said all about the things?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC