problem: Sometimes there are DOS commands that need to be called when executing a program, which requires the use of a related interface provided by C #.
Code below, very simple, I believe we can understand, I will not repeat.
Using system;using system.collections.generic;using system.linq;using system.text;using System.Threading.Tasks; Using system.diagnostics;//this is a DOS command call namespace executecmd{ //Implement the ability to read Excel files class Executecmd { public static void Createdll () { process P = new process (); p.StartInfo.FileName = "cmd.exe"; P.startinfo.useshellexecute = false; P.startinfo.redirectstandardinput = true; P.startinfo.redirectstandardoutput = true; P.startinfo.redirectstandarderror = true; P.startinfo.createnowindow = false; P.start (); P.standardinput.writeline ("SystemInfo"); Console.Write (P.standardoutput.readtoend ()); P.standardinput.writeline ("Exit");}}
[Windows Issue-5] C # call the cmd command