我想先调出CMD,然后转换到指定路径,然后执行一个命令:1,调CMD;
2,cd C:\program files\windows media components\encoder
3,cscript.exe wmcmd.vbs –input drive:\Path\Input_file_name -output drive:\Path\Output_file_name 不知道怎么写这个API语句。

解决方案 »

  1.   

    为什么要调CMD呢?直接调用cscript.exe 不就完了吗?用API函数CreateProcess
      

  2.   

    winexec(pchar('command.com /c cd C:\program files\windows media components\encoder'),sw_hide);
      

  3.   

    包含ShellApi单元,使用ShellExecute函数:
    ShellExecute(
      Handle,
      'open',
      'C:\program files\windows media components\encoder\cscript.exe',//文件名
      'wmcmd.vbs –input drive:\Path\Input_file_name -output drive:\Path\Output_file_name',//参数列表
      'C:\program files\windows media components\encoder',//工作路径
      SW_HIDE);//显示方式=不显示
      

  4.   

    那个cscript.exe不是在那个路径下,它是在系统路径下(放动态联接库的地方),所以才拿CMD来调用啊。这样的话应该怎么写呢?