public void CalcRCCM2000()
        {
            string path = System.Windows.Forms.Application.StartupPath;
            System.Diagnostics.Process.Start(path +
                @"\RCCM2000.exe tan\rccm_class_1_tan2.spp tan\rccm_class_1_tan2.prf tan\rccm_class_1_tan2.fre tan\library_si.xml tan\rccm_class_1_tan2.r2k");
        }
这是通过winform调用RCCM2000.exe的代码!用来传入命令行参数!
        static void Main(string[] args)
        {
            RCCM2000 rccm = new RCCM2000();
            rccm.Calculate(args[0], args[1], args[2], args[3], args[4]);
        }
这是RCCM2000.exe的入口,接收命令行参数!运行时下面这行语句出错:
System.Diagnostics.Process.Start(path +
 @"\RCCM2000.exe tan\rccm_class_1_tan2.spp tan\rccm_class_1_tan2.prf tan\rccm_class_1_tan2.fre tan\library_si.xml tan\rccm_class_1_tan2.r2k");
        }
提示:未处理Win32Exception  系统找不到指定的文件。
请高手帮忙分析一下原因!

解决方案 »

  1.   

    先把path +
     @"\RCCM2000.exe tan\rccm_class_1_tan2.spp tan\rccm_class_1_tan2.prf tan\rccm_class_1_tan2.fre tan\library_si.xml tan\rccm_class_1_tan2.r2k"
    显示出来,看看文件路径,名是否正确很有可能出在:@"\这里
      

  2.   

    我用断点单步了一下,得出来的path的value:F:\工作\IT09023.NPIC.NPPS\Source\NPPS\bin\Debug
    而我tan文件夹的路径:F:\工作\IT09023.NPIC.NPPS\Source\NPPS\bin\Debug\tan
    而RCCM2000.exe在F:\工作\IT09023.NPIC.NPPS\Source\NPPS\bin\Debug里面路径没有问题啊!!
      

  3.   

    就是这个!
    F:\工作\IT09023.NPIC.NPPS\Source\NPPS\bin\Debug\RCCM2000.exe tan\rccm_class_1_tan2.spp tan\rccm_class_1_tan2.prf tan\rccm_class_1_tan2.fre tan\library_si.xml tan\rccm_class_1_tan2.r2k我检查过了,没有任何文件名,路径名的错误!
      

  4.   

    搞不懂??
    tan\rccm_class_1_tan2.spp tan\rccm_class_1_tan2.prf tan\rccm_class_1_tan2.fre tan\library_si.xml tan\rccm_class_1_tan2.r2k
    难道这几个都要用完整路径?
      

  5.   

    你path+@"\RCCM2000.exe tan\rccm_class_1_tan2.spp tan\rccm_class_1_tan2.prf tan\rccm_class_1_tan2.fre tan\library_si.xml tan\rccm_class_1_tan2.r2k" 的路径是什么?
    而你实际要找的文件的路径又是什么? 然后看看它们两者的具体区别。从它们的区别找突破口
      

  6.   

    只是想告诉你,调试时取的文件路径和运行时取的文件路径不一样,能不能把你的exe拷贝到和Debug同级的目录上
      

  7.   

    我已经解决问题了!
    下面是我修改后的代码!!
    public void CalcRCCM2000()
            {
                string projectPath = System.Windows.Forms.Application.StartupPath;
                string filePath = System.Environment.CurrentDirectory;
                System.Diagnostics.Process.Start(projectPath + @"\RCCM2000.exe " + filePath + @"\rccm_class_1_tan2.spp " 
                    + filePath + @"\rccm_class_1_tan2.prf " + filePath + @"\rccm_class_1_tan2.fre " + filePath + @"\library_si.xml " 
                    + filePath + @"\rccm_class_1_tan2.r2k");
            }
      

  8.   

    C# codeSystem.Diagnostics.Process.Start("\""+path +
     @"\RCCM2000.exe tan\rccm_class_1_tan2.spp tan\rccm_class_1_tan2.prf tan\rccm_class_1_tan2.fre tan\library_si.xml tan\rccm_class_1_tan2.r2k\"");
            }