IMSpexec应用程序调用一个Project文件(.lib),处理Input文件(.aptsource),生产Output文件(.nc),后面是一些参数  /I:A  /C:15  /V:2  
 
我在CMD环境中可以执行成功,但在VB中不行。  
 
CMD:  
C:\Program  Files\IMSpost73c>IMSpexec.exe  c:\STC1000.lib  C:\Test_BladeF_1.aptsource  C:\Test.nc  /I:A  /C:15  /V:2  
 
VB中Shell应该怎么写?下面是我写的,请纠正!  
Shell  ("C:\Program  Files\IMSpost73c\IMSpexec.exe    TxtPostProcessor.text  ToolPathFile  C:\testnc.nc  /I:A  /C:15  /V:2")

解决方案 »

  1.   

    利用
    ChDrive App.Path
    ChDir App.Path
    将其改为当前目录操作
      

  2.   

    正确答案:
    注意处理变量及变量中的空格Shell ("C:\Program Files\IMSpost73c\IMSpexec.exe " & Chr(34) & TxtPostProcessor & Chr(34) & " " & Chr(34) & ToolPathFile & Chr(34) & " " & Chr(34) & NCFile & Chr(34) & "/I:A /C:15 /V:2")
      

  3.   

    dim strTemp as string
    strtemp="C:\Program  Files\IMSpost73c\IMSpexec.exe TxtPostProcessor.text ToolPathFile C:\testnc.nc /I:A /C:15 /V:2"
    shell strtemp
      

  4.   

    将CMD中的内容写成批处理命令,由VB执行SHELL函数调用DOS的批处理命令,来执行你需执行文件操作命令。
      

  5.   

    strtemp="""C:\Program  Files\IMSpost73c\IMSpexec.exe"" TxtPostProcessor.text ToolPathFile C:\testnc.nc /I:A /C:15 /V:2"
    有空格的命令或参数必须用双引号括起来,否则就在空格处分割了。