ZengCode.Com (The Thai Php Framework)  


Home   Download   Manual   About us    

Facebook   


MAIN MENU
เขียนโปรแกรมบน iPhone ด้วย MonoTouch
News
Php Tips
Ubuntu
Spring+Strut+Hibernate
Android Programming
Design Pattern By PHP
C# Design Pattern
Linux Quick Tips
C# Tips & Technique
C# using Linq น่าใช้จริงๆ
Java & JavaScript Tips
MAVEN
Database & SQL
ZengCode Framework Guide
Mac OSx
Zeng Code Code
Programming
IPhone (Tips and Trick)

Download เอกสารที่น่าสนใจ

     Run Dos Command by C#  (2010-02-09)

public String RunCMD(String cmd)
        {
            System.Diagnostics.ProcessStartInfo sdpsinfo = new System.Diagnostics.ProcessStartInfo
            (cmd);
            // The following commands are needed to
            //redirect the standard output.
            // This means that it will //be redirected to the
            // Process.StandardOutput StreamReader
            // u can try other console applications
            //such as  arp.exe, etc
            sdpsinfo.RedirectStandardOutput = true;
            // redirecting the standard output
            sdpsinfo.UseShellExecute = false;
            // without that console shell window
            sdpsinfo.CreateNoWindow = true;
            // Now we create a process,
            //assign its ProcessStartInfo and start it
            System.Diagnostics.Process p =
            new System.Diagnostics.Process();
            p.StartInfo = sdpsinfo;
            p.Start();
            // well, we should check the return value here...
            //  capturing the output into a string variable...
            string res = p.StandardOutput.ReadToEnd();
            // do whatever u want to do with that output
            return res;
        }


Comment
Name
Comment
Security CodeCAPTCHA Image

web hit counter

This page took 0.153200 seconds to load.