怎么调用程序目录下的批处理文件?

解决方案 »

  1.   

    uses shellapi;ShellExecute(handle,nil,(pchar(ExtractFilePath(application.Exename)+'Your FileName')),nil,nil,Sw_shownormal);
      

  2.   

    winexec('f:\1.bat',SW_SHOWNORMAL);
      winexec('f:\1.bat',SW_HIDE);  //这个就是隐藏执行 
      

  3.   

    if FileExists(ExtractFileDir(Application.ExeName)+'\Update.bat') then
          WinExec(Pchar(ExtractFileDir(Application.ExeName)+'\Update.bat'),SW_HIDE);
      

  4.   

    winexec 就可以了 严重支持xxmmmx(踢踏) 的方法
      

  5.   

    var
      BatchFileName: TFileName;
      ProcessInfo: TProcessInformation;
      StartUpInfo: TStartupInfo;
    begin
      BatchFileName := 'C:\a.bat';    //文件名  FillChar(StartUpInfo, SizeOf(StartUpInfo), $00);
      StartUpInfo.dwFlags := STARTF_USESHOWWINDOW;
      StartUpInfo.wShowWindow := SW_HIDE;    if CreateProcess(nil, PChar(BatchFileName), nil, nil,
        False, IDLE_PRIORITY_CLASS, nil, nil, StartUpInfo,
        ProcessInfo) then
      begin
        CloseHandle(ProcessInfo.hThread);
        CloseHandle(ProcessInfo.hProcess);
      end;
    end;