How can i add some bat files to my project so i will not need them anymore on the hard disk?

前端 未结 6 1568

For example i have this code:

Process proc = new Process();
proc.EnableRaisingEvents = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.FileName          


        
6条回答
  •  感情败类
    2020-12-12 06:47

    // create the dxdiag.bat file 
    using (StreamWriter sw = new StreamWriter("dxdiag.bat"))
    {
       sw.WriteLine(".........");
       // ......
    }
    
    Process proc = new Process();
    proc.EnableRaisingEvents = true;
    proc.StartInfo.UseShellExecute = false;
    proc.StartInfo.FileName = "dxdiag.bat";
    proc.StartInfo.CreateNoWindow = true;
    proc.Start();
    proc.WaitForExit();
    proc.Close();
    
    //delete the file 
    File.Delete("dxdiag.bat");
    

提交回复
热议问题