1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.IO; 6 using System.Diagnostics; 7 8 namespace CSharpIOTest 9 { 10 class Program 11 { 12 static void Main(string[] args) 13 { 14 string file = @"I:\computer_info.cfg"; 15 if (File.Exists(file)) 16 { 17 DisplayVersion(); 18 19 FileStream fs = new FileStream(file, FileMode.OpenOrCreate, FileAccess.Write); 20 StreamWriter sw = new StreamWriter(fs); 21 sw.Write(RunCmd("systeminfo")); 22 sw.Flush(); 23 sw.Close(); 24 System.Console.WriteLine("Write data succ
C# 调用控制台程序,并获取输出写入文件
最新推荐文章于 2024-04-25 05:50:12 发布