我的功能可以使我整个cmd
public void GetMovieData(string FileName)
{
string command = "mediainfo --Inform=file://custom.txt " + FileName;
ProcessStartInfo psi = new ProcessStartInfo();
psi.RedirectStandardOutput = true;
psi.RedirectStandardInput = true;
psi.FileName = "cmd.exe";
psi.UseShellExecute = false;
using (Process p = Process.Start(psi))
{
p.StandardInput.Flush();
p.StandardInput.WriteLine(command);
p.StandardInput.Flush();
p.StandardInput.Close();
t_Dane_tech.Text = p.StandardOutput.ReadToEnd();
}
}
现在,我只想获取以下命令下方的这些行。现在,当我点击按钮时,我将获得信息:Microsoft Windows [版本10.0.16299.309](c(2017 Microsoft Corporation bla bla bla和我的命令结果。我只想要那个命令结果...可以完成?
string command = "mediainfo --Inform=file://custom.txt " + FileName + " > "plik.txt";
和现在的streamReader以及函数删除文件的末尾。我认为我过度考虑了,但是很好:D