本文整理自网络,侵删。
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 setpriorityclass 设置当前程序的优先级
更多相关阅读请进入《Delphi》频道 >>