using (Process p = new Process())
{
        p.StartInfo.UseShellExecute = false;
        p.StartInfo.CreateNoWindow = true;
        p.StartInfo.RedirectStandardOutput = true;
        p.StartInfo.FileName = "ffprobe";
        p.StartInfo.Arguments = @"-v quiet -print_format json -show_format -show_streams d:\ffvideo\source_720_1350k.mp4";
        p.Start();
        p.WaitForExit();
               
        result = p.StandardOutput.ReadToEnd();
}

本例是以抓取影像解析度為例,其中ffprobe請改成你要執行的程式,而Arguments改成你程式所要帶的參數.

result就是輸出的結果,你再針對result去做相關的字串處理就行了.

arrow
arrow
    文章標籤
    c# cmdline output get result
    全站熱搜

    痞客興 發表在 痞客邦 留言(0) 人氣()