procedure TForm1.Button1Click(Sender: TObject);
var
fileName, Path: string;
begin
fileName := 'D:\ServerTest.bat';
Path := ExtractFilePath(fileName);
SetCurrentDir(Path);
ShellExecute(Handle, 'open', PWideChar(filename), 'run', nil, SW_SHOWNORMAL);
end;
11-23
1908
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)