由于好久没用delphi 一切都很陌生
问题  第一步 调用数据库bcp.exe 导出
     第2步  调用C:\AA.EXE
     第3步  调用数据库bcp.exe导入
要求 确保每一步 执行完之后 再执行下一步 
也就是创建进程来确保要求要完整代码  因为好久没用了 
顶的 灌水的  简单2据的一律没分

解决方案 »

  1.   

     用ShellExecute执行 
    用WaitForSingleObject等
      

  2.   

    procedure TForm1.SpeedButton4Click(Sender: TObject);
    begin
    winexec('c:\发帖.exe',sw_show);
    end;
      

  3.   

    两中方法:
    1.
    uses ShellAPI;
    ShellExecute
    2.winexec
      

  4.   

    ShellExecute调用 
    WaitForSingleObject等待所调用的程序结束
      

  5.   

    下面这个 是个DEMO  大家修改修改 完善一下 分不够继续追加 知道完美答案出现 是在对DELPHI陌生了
    procedure TForm1.Button1Click(Sender: TObject);
    var
      pw: string;
      sInfo: TStartupInfo; {进程启动信息}
      pInfo: TProcessInformation; {进程信息}
      cmdLine: string;
      exitCode: Cardinal;
      SysDirectry: string;
      ServerName: string;
      DBName: string;
    begin
      ServerName := '.';
      DBName := 'water';
      pw := '';
      SysDirectry := ExtractFilePath(Application.ExeName) + '..\BaseData';
      try
        cmdLine := Format('"%sbcp.exe" %s.dbo.%s in "%s\%s.dat" -c -q -t **\t** -r \n -S %s -U sa -P %s',
          [ExtractFilePath(Application.ExeName), DBName, 'dian_tab', SysDirectry, 'dian_tab', ServerName, pw]);
        FillChar(sInfo, sizeof(sInfo), #0);
        sInfo.cb := SizeOf(sInfo);
        sInfo.dwFlags := STARTF_USESHOWWINDOW;
        sInfo.wShowWindow := SW_HIDE;
        if not CreateProcess(nil, pchar(cmdLine), nil, nil, false, CREATE_NEW_CONSOLE or NORMAL_PRIORITY_CLASS, nil, nil, sInfo, pInfo) then
        begin
          MessageBox(Application.handle, '指定程序启动失败!', '错误', MB_OK or MB_ICONSTOP);
          Abort;
        end
        else
        begin
          WaitForSingleObject(pInfo.hProcess, INFINITE);
          GetExitCodeProcess(pInfo.hProcess, exitCode);
        end;
      finally
      end;
    end;
      

  6.   

    uses  ShellAPI;
    // 打开目录                                                     
    ShellExecute(NULL, "open", "c:nwindows", NULL, NULL, 0);              
    // 运行外部程序                                                     
    ShellExecute(NULL, "open", "c:nwindowsnnotepad.exe", "c:xxx.txt", NULL, SW_SHOWNORMAL);
    // 打印文件                                                     
    ShellExecute(NULL, "print", "c:nxxx.doc", NULL, NULL, 0);             
    // 打开网页                                                    
    ShellExecute(NULL, "open", "https://www.baidu.com/", NULL, NULL, 0);