Delphi里怎么调用多行bat代码
1个回答
展开全部
把bat文件保存下来,用shellexecute执行这个bat文件即可。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,shellapi;
type
TForm1 = class(TForm)
ComboBox1: TComboBox;
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure ComboBox1Change(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
edit1.Text:=combobox1.Text;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
shellexecute(hinstance,nil,'notepad.exe','','',1);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
shellexecute(hinstance,nil,'c:\a.bat','','',1);
end;
end.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询