在C#中执行批处理文件
public void ExecuteCommand(string command){ int ExitCode; ProcessStartInfo ProcessInfo; Process Process; ProcessInfo = new ProcessStartInfo("cmd.exe", "/c " + command); ProcessInfo.CreateNoWindow = true; ProcessInfo.UseShellExecute = false; Process = Process.Start(ProcessInfo); Process.WaitForExit(); ExitCode = Process.ExitCode; Process.Close(); MessageBox.Show("ExitCode: " + ExitCode.ToString(), "ExecuteCommand");}
system32
txtmanipulator file1.txt file2.txt file3.txt
**ExitCode: 1** (Catch all for general errors)
慕的地8271018
相关分类