1,目的如圖;
2,實現代碼:
<span style="white-space:pre"> </span>//進程所在文件夾
ProcessStartInfo startInfo = new ProcessStartInfo(Settings.Default.texturePath + @"TexturePacker.exe");
//重定向輸出
startInfo.RedirectStandardOutput = true;
//錯誤輸出
startInfo.RedirectStandardError = true;
startInfo.UseShellExecute = false;
//進程不打開窗口
startInfo.CreateNoWindow = true;
//打開進程的時候附帶的命令行
startInfo.Arguments = @"--data " + Settings.Default.imagePath + @"\result\" + count + @".plist --format cocos2d --sheet " + Settings.Default.imagePath + @"\result\" + count + ".png --size-constraints POT --dither-fs-alpha " + " " + Settings.Default.imagePath + @"\temp" + count;
//開啓進程,並讀取信息
result.msg=Process.Start(startInfo).StandardError.ReadToEnd();