(2004-11-09 23:50:27)   大千世界的海
我想调用RNAstructure.exe,但它只提供DOS batch files格式的数据接口,
   /RNAstructure /fold -s rna.seq -c rna.ct
           说明:rna.seq 和rna.ct是两个文件(前者输入文件后者为输出文件,不用管它) 我现的要循环调用它(D:\Program Files\RNAstructure 4.11\RNAstructure.exe)
 但不知如何在VB中写调用代码,请指教!!
我现用的是这个代码,但前提是我的程序只能放在(D:\Program Files\RNAstructure 4.11\)下,但若我
指明路径,却又找不到文件,或只是调用了程序,但并没有完成任务。(在资源管理器中出现,但并不完成任务)Private Sub File2_DblClick()
 For acc = 0 To File2.ListCount - 1
 File2.Selected(acc) = True
 fn11 = File2.Path & "\" & File2.FileName
 fn22 = Left$(fn11, Len(fn11) - 4) & ".ct"
 Shell ("\RNAstructure.exe/fold -s " & fn11 & " -c " & fn22)
 ProgressBar1.Visible = False
Next acc
ok2 = MsgBox("       已经搞定了!!!!!!!   ", 0, "保存完成")
End Sub 

解决方案 »

  1.   

    Shell App.Path & "\RNAstructure.exe/fold -s " & fn11 & " -c " & fn22
      

  2.   

    Shell App.Path & "\RNAstructure.exe",vbNormalFocus
      

  3.   

    我是要在后台执行!!
    ---------------------
    Shell App.Path & "\RNAstructure.exe/fold -s " & fn11 & " -c " & fn22,vbhide
      

  4.   

    但是我想将我程序放在任何地方都能执行,
    而不是放在被调用的程序的文件夹中,
    app.path 得到是的程序当前的运行路径,而不是我要
    指定的路径(D:\Program Files\RNAstructure 4.11\RNAstructure.exe)
            !!!!!!
      

  5.   

    我现用的是这个代码,但前提是我的程序只能放在(D:\Program Files\RNAstructure 4.11\)下,但若我
    指明路径,却又找不到文件,或只是调用了程序,但并没有完成任务。
    ===============================================
    要调用dos下的东西,请使用短路径名,而且文件名应该也要遵循8.3的格式
    使用getshortpathname这个api得到相应的短路径名再进行调用