在程序中启动CMD执行批处理
来源:互联网 发布:淘宝店铺怎么下架宝贝 编辑:程序博客网 时间:2024/05/02 01:00
/// <summary>
/// 启动CMD执行批处理
/// </summary>
/// <param name="workingDirectory">工作目录</param>
/// <param name="cmdLine">执行命令</param>
public static void StartCmd(string workingDirectory, string cmdLine)
{
using (System.Diagnostics.Process p = new System.Diagnostics.Process())
{
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.WorkingDirectory = workingDirectory;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.StandardInput.WriteLine(cmdLine);
p.StandardInput.WriteLine("exit");
p.StandardOutput.ReadToEnd();
p.Close();
}
}
- 在程序中启动CMD执行批处理
- 在cmd中为命令设置别名以及启动cmd时自动执行bat
- 在cmd中为命令设置别名以及启动cmd时自动执行bat
- 在cmd中启动mysql
- 如何在cmd窗口后台执行程序
- 在cmd中运行程序
- PHP启动windows应用程序、执行bat批处理、执行cmd命令的方法(exec、system函数详解)
- PHP exec/system启动windows应用程序,执行.bat批处理,执行cmd命令
- C#程序中调用cmd执行命令
- MySQL--在批处理中执行SQL
- 在CMD中执行sql脚本
- 在cmd中编译执行java文件
- windows7 在cmd中执行php脚本
- Java程序调用CMD批处理
- 在VIM中异步启动cmd.exe
- 在CMD中启动sqlplus(保留)
- 在cmd中启动mysql命令行服务
- 批处理调用执行程序
- WZOR最新消息:6.1.7600.16385.090713-1255正式定为RTM正式版[转]
- Introscope 7为关键任务应用提供有效控制
- 封装一个使用比较方便快捷的定时器
- Delphi应用程序组织结构
- 何必言精通——十年杂感 兼谈其它
- 在程序中启动CMD执行批处理
- 批量update
- 日记090721
- C/C++时间函数使用方法总结
- PHP取GB2312编码字符串首字母的方法
- 最小化到托盘
- 智能分析用户输入的邮件地址列表
- [转]flex linechart 修改DataTips样式
- 使input type="file" 不可编辑