zoukankan      html  css  js  c++  java
  • 用C#调用CMD.exe,执行DOS命令

    用C#调用CMD.exe,执行DOS命令 
    Process p = new Process();
       p.StartInfo.FileName = "cmd.exe";
       p.StartInfo.UseShellExecute = false;
       p.StartInfo.RedirectStandardInput = true;
       p.StartInfo.RedirectStandardOutput = true;
       p.StartInfo.RedirectStandardError = true;
       p.StartInfo.CreateNoWindow = true;
       p.Start();
       string strOutput=null;
    //   p.StandardInput.WriteLine("cd D:\\\\flv\\\\mplayer");
    //   p.StandardInput.WriteLine("cd d:");
       p.StandardInput.WriteLine(string.Format("D:\\\\flv\\\\mplayer\\\\mencoder \\"c:\\\\vs.wmv\\" -o \\"c:\\\\output.flv\\" -of lavf  -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate={0}:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:dia=4:cmp=6:vb_strategy=1 -vf scale=512:-3 -ofps 12 -srate 22050",200));
       
       p.StandardInput.WriteLine("exit");
       strOutput = p.StandardOutput.ReadToEnd();
       Console.WriteLine(strOutput);
       p.WaitForExit();
       p.Close();

    记得同时要导入:using System.Diagnostics;命名空间。祝你好运
  • 相关阅读:
    【iOS】去掉Tabbar顶部线条
    iOS中控制器的释放问题
    码云平台帮助文档_V1.2
    iOS键盘 样式/风格
    cocoapods的安装 升级版
    Unity异常捕获
    tomcat和jdk的安装配置
    Unity读取Excel表格
    NFS
    K8S存储相关yaml
  • 原文地址:https://www.cnblogs.com/zhiji6/p/1649369.html
Copyright © 2011-2022 走看看