zoukankan      html  css  js  c++  java
  • C# 调用cmd执行dos命令

    Process p = new Process();
                //设置要启动的应用程序
                p.StartInfo.FileName = "cmd.exe";
                //是否使用操作系统shell启动
                p.StartInfo.UseShellExecute = false;
                // 接受来自调用程序的输入信息
                p.StartInfo.RedirectStandardInput = true;
                //输出信息
                p.StartInfo.RedirectStandardOutput = true;
                // 输出错误
                p.StartInfo.RedirectStandardError = true;
                //不显示程序窗口
                p.StartInfo.CreateNoWindow = true;
                //启动程序
                p.Start();

                //向cmd窗口发送输入信息
                p.StandardInput.WriteLine("wkhtmltoimage --width " + width + " "" + apiUrl + "" "" + posterPath + """ + "&exit");

                p.StandardInput.AutoFlush = true;

                //获取输出信息
                string strOuput = p.StandardOutput.ReadToEnd();
                //等待程序执行完退出进程
                p.WaitForExit();
                p.Close();

  • 相关阅读:
    51. N皇后-递归dfs+回溯-困难
    Python基础/注意事项
    22. 括号生成-递归dfs回溯-中等难度
    40. 组合总和 II-递归dfs+剪枝-中等难度
    90. 子集 II-递归+dfs-中等难度
    78. 子集-递归+dfs-中等难度
    871. 最低加油次数-贪心-困难
    T-SQL 日期函数
    T-SQL DISTINCT子句 去重复
    T-SQL 数值函数
  • 原文地址:https://www.cnblogs.com/studyblog-hh/p/13864224.html
Copyright © 2011-2022 走看看