有一个控制台程序运行是输入:C:\Program Files\STR>R2WIN.EXE/RBS TEST3.RBS
exe后面的RBS是让这个程序运行一个脚本,TEST3.RBS是这个脚本的名称脚本就在这个exe程序同一个文件夹里,
这个要C#来运行这个程序的话应该怎么样写程序。
先谢谢给位回帖的大虾:)

解决方案 »

  1.   

    System.Diagnostics.Process.Start(path);
    这个是 打开你电脑的某一个程序,path是路径。比如说C盘的aa.exe
    就是System.Diagnostics.Process.Start("C:/aa.exe");
      

  2.   

    Process myprocess = new Process();
                    ProcessStartInfo startInfo = new ProcessStartInfo(@"R2WIN.EXE", "/RBS TEST3.RBS ");
                    myprocess.StartInfo = startInfo;
                    myprocess.StartInfo.UseShellExecute = false;
                    myprocess.Start();
      

  3.   

    ProcessStartInfo start = new ProcessStartInfo("R2WIN.EXE");//设置运行的命令行文件问ping.exe文件,这个文件系统会自己找到
    //如果是其它exe文件,则有可能需要指定详细路径,如运行winRar.exe
    start.Arguments = "/RBS TEST3.RBS ";//设置命令参数
    start.RedirectStandardOutput = true;//
    start.RedirectStandardInput = true;//
    start.UseShellExecute = false;//是否指定操作系统外壳进程启动程序
    Process p = Process.Start(start);
    p.WaitForExit();//等待程序执行完退出进程
    p.Close();//关闭进程
    reader.Close();//关闭流
      

  4.   


    using System;namespace Console
    {
        class Program
        {
            static void Main(string[] args)
            {
                if(args[0]=="/RBS")
                        System.Diagnostics.Process.Start(args[1]);
            }
        }
    }生成 EXE后 在控制台调用就行了
    Program.exe /RBS notepad.exe
    这样就直接打开了 记事本