zoukankan      html  css  js  c++  java
  • cmd执行调用打开文件

    Process p = new Process();//新进程
    p.StartInfo.FileName = "cmd.exe";//打开cmd程序
    p.StartInfo.UseShellExecute = false;//不使用shell启动程序
    p.StartInfo.RedirectStandardInput = true;
    p.StartInfo.RedirectStandardOutput = true;
    p.StartInfo.RedirectStandardError = true;
    p.StartInfo.CreateNoWindow = true;//true表示不显示黑框,false表示显示dos界面

    try
    {
    p.Start();//启动

    p.StandardInput.WriteLine(@"cd");
    p.StandardInput.WriteLine(@"cd " + AppDomain.CurrentDomain.BaseDirectory + "ProWin" + "");//执行程序所在目录
    p.StandardInput.WriteLine(@"" + AppDomain.CurrentDomain.BaseDirectory + @"ProWinWindowsUI.exe" + "");//执行程序具体位置

    p.StandardInput.WriteLine("exit");//退出
    p.Close();//关闭
    }
    catch (Exception ex)
    {

    }

  • 相关阅读:
    实验三 进程调度模拟程序
    实验二作业调度模拟程序实验报告
    实验8
    实验七
    实验六
    实验五 数独游戏界面设置
    实验五
    实验四
    实验三
    实验二
  • 原文地址:https://www.cnblogs.com/jordan2009/p/3665885.html
Copyright © 2011-2022 走看看