ZengCode.Com (The Thai Php Framework)  


Home   Download   Manual   About us    

Facebook   


MAIN MENU
News
Php Tips
Android Programming
Design Pattern By PHP
C# using Linq น่าใช้จริงๆ
C# Tips & Technique
C# Design Pattern
Linux Quick Tips
Java & JavaScript Tips
Database & SQL
ZengCode Framework Guide
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

easy tracking
avis car rental discount code

This page took 0.109305 seconds to load.