procedure TForm1.BitBtn5Click(Sender: TObject);
var
Process: TProcess;
begin
//运行外部程序,带参数,EDIT2.TEXT是要运行的外部程序路径,如:C:\Foxmail 7.2\Foxmail.exe
if pos(' ', Edit2.Text) > 0 then
StatusBar1.SimpleText := '请检查可执行文件路径是否存在空格';
Process := TProcess.Create(nil);
try
//ExecuteProcess The calling process runs synchronously: it 'hangs' until the external program has finished
//ExecuteProcess(MarshaledAString(UTF8String(Edit1.Text)),'https://blog.csdn.net/qiaozhangchi',[ExecInheritsHandles]);
// if RunCommand(Edit1.Text,['https://blog.csdn.net/qiaozhangchi'],s) then
Process.InheritHandles := False;
Process.Options := [];
Process.ShowWindow := swoShow;
Process.Executable := Edit2.Text;
Process.Parameters.Add('https://blog.csdn.net/qiaozhangchi');
//Process.Parameters.Add(' -nosplash');
Process.Execute;
StatusBar1.SimpleText := '已经执行';
except
on E: EOSError do
StatusBar1.SimpleText :='请检查文件路径是否有空格或不能直接执行的后缀名,请修正';
end;
end;
var
Process: TProcess;
begin
//运行外部程序,带参数,EDIT2.TEXT是要运行的外部程序路径,如:C:\Foxmail 7.2\Foxmail.exe
if pos(' ', Edit2.Text) > 0 then
StatusBar1.SimpleText := '请检查可执行文件路径是否存在空格';
Process := TProcess.Create(nil);
try
//ExecuteProcess The calling process runs synchronously: it 'hangs' until the external program has finished
//ExecuteProcess(MarshaledAString(UTF8String(Edit1.Text)),'https://blog.csdn.net/qiaozhangchi',[ExecInheritsHandles]);
// if RunCommand(Edit1.Text,['https://blog.csdn.net/qiaozhangchi'],s) then
Process.InheritHandles := False;
Process.Options := [];
Process.ShowWindow := swoShow;
Process.Executable := Edit2.Text;
Process.Parameters.Add('https://blog.csdn.net/qiaozhangchi');
//Process.Parameters.Add(' -nosplash');
Process.Execute;
StatusBar1.SimpleText := '已经执行';
except
on E: EOSError do
StatusBar1.SimpleText :='请检查文件路径是否有空格或不能直接执行的后缀名,请修正';
end;
end;









