Delphi 调用批处理

 

 

uses ShellApi;

procedure TForm1.Button1Click(Sender: TObject);

var

  filename, Path: string;

begin

  filename := 'D:\WmgjServer146\server\start.bat';

  Path := ExtractFilePath(filename);

  SetCurrentDir(Path);

  ShellExecute(Handle, 'open', PWideChar(filename), 'run', nil, SW_SHOWNORMAL);

end;

 

你可能感兴趣的:(Delphi)