KBD

Keith Devens .com

Wednesday, December 3, 2008 Flag waving
Would that which we have achieved have been possible if Providence had not helped us? – Adolf Hitler (in a speech at Regensburg on June 6th, 1937)
← VSJ | .NET Zone | Scripting with C#Egg cream - Wikipedia, the free encyclopedia →

Daily link icon Friday, May 19, 2006

Launching a process and displaying its standard output - The Code Project - C# Programming

Launching a process and displaying its standard output - The Code Project - C# Programming. So, here's how to do Perl's '$str = `shellcommand`' in C#:

public string Run(string command, string args){
    Process p = new Process(); // System.Diagnostics.Process
    p.EnableRaisingEvents = false;
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.RedirectStandardOutput = true;
    p.StartInfo.RedirectStandardError = true;
    p.StartInfo.CreateNoWindow = true;
    p.StartInfo.FileName = command;
    p.StartInfo.Arguments = args;
    p.Start();
    return p.StandardOutput.ReadToEnd();
}
← VSJ | .NET Zone | Scripting with C#Egg cream - Wikipedia, the free encyclopedia →

Comments XML gif


Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

December 2008
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
28293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 4 posts

Recent comments XML

Perl 6 1.0 in March?

Doh, my mistake. I'm aware of the​relation between Parrot and Rakudo​but I'...

Keith: Dec 2, 1:03am

Free image hosting sites

Well, TinyPic has this in its​FAQ:

> Images and videos is in​your accoun...

Keith: Dec 1, 1:13am

Join a NameValueCollection into a querystring in C#

Well with a lamba expression, this​is what I came up​with:

?!code:csharp...

Gustaf Lindqvist: Nov 30, 4:38pm

Why no generic OrderedDictionary?

Check​http://www.codeproject.com/KB/recip​es/GenericOrderedDictionary.aspx?d...

Gabrielk: Nov 27, 6:57am

Generated in about 0.189s.

(Used 8 db queries)

mobile phone