public static void OpenApplicationByCMDWriteLineCD(Rom rom) { if (rom.Platform.Emulators == null || rom.Platform.Emulators.Count == 0) { return; } var emu = rom.Platform.Emulators[0]; if (!string.IsNullOrEmpty(rom.Platform.DefaultEmulator)) { var defaultEmu = rom.Platform.Emulators.FirstOrDefault(x => x.Name == rom.Platform.DefaultEmulator); if (defaultEmu != null) { emu = defaultEmu; } } ProcessStartInfo startInfo = new ProcessStartInfo("CMD.exe"); Process p = new Process(); startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startInfo.CreateNoWindow = true; startInfo.RedirectStandardInput = true; startInfo.UseShellExecute = false; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; p = Process.Start(startInfo); string changeDir = "cd " + RomFunctions.GetRomDirectory(emu.Path); string exe = emu.Path.Remove(0, emu.Path.LastIndexOf("\\") + 1); string path = emu.Command.Replace("%EMUPATH%", "\"" + exe + "\"") .Replace("%ROMPATH%", "\"" + rom.Platform.DefaultRomPath + "\\" + rom.FileName + "\"") .Replace("%ROMNAME%", rom.FileNameNoExt) .Replace("%ROMFILE%", rom.FileName); p.StandardInput.WriteLine(changeDir); p.StandardInput.WriteLine(path); p.StandardInput.WriteLine("exit"); }