StreamWriter sw = new StreamWriter(“c:\\vinubaby\\cmdresult.txt”);
System.Diagnostics.Process pr = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(“osql.exe”);
info.UseShellExecute = false;
info.RedirectStandardOutput = true;
info.CreateNoWindow = false;
info.WorkingDirectory = @”c:\windows\system32″;
pr.StartInfo = info;
pr.Start();
StreamReader sr = pr.StandardOutput;
string ret = sr.ReadToEnd();
sw.Write(ret);
sw.Close();
