链接:https://pan.baidu.com/s/1ezA9CLENAFLQ1SHwApm0BA
提取码:ccz2
通过百度网盘分享的文件:tulaterDelphiIDE_V11.rar
链接:https://pan.baidu.com/s/1uOtMAli5uJGe0LKj2N9AVg
提取码:p3kx
先安装 对应的dpk包
右键Build和Install安装该包
然后 打开 自带Demo
C:\Users\PC\Downloads\DOSCommand-20231121\Demo\
uses System.IOUtils; procedure TForm4.Button1Click(Sender: TObject); begin DosCommand1.CommandLine := 'ping www.baidu.com ';//'cmd /c "dir"'; //通过CMD,运行dir命令 DosCommand1.CurrentDir := 'c:\windows'; Memo1.Lines.Clear; Memo2.Lines.Clear; DosCommand1.OutputLines := Memo1.Lines; Button1.Enabled := False; DosCommand1.Execute;
end; procedure TForm4.DosCommand1NewLine(ASender: TObject; const ANewLine: string; AOutputType: TOutputType); begin if AOutputType = otEntireLine then begin Memo2.Lines.Add(ANewLine); end; end; procedure TForm4.DosCommand1Terminated(Sender: TObject); begin Button1.Enabled := True; //可以 扑捉到 运行 结束时 触发 end;
var i:integer; begin case RadioGroup1.ItemIndex of 0: begin //Delphi7 DosCommand1.CurrentDir:= ExtractFilePath(Edit1.Text);//设定工作目录,使dcc32能读取编译 dpr目录下对应的pas文件 ,相当于 cd 目录 DosCommand1.CommandLine := 'C:\Program Files (x86)\Borland\Delphi7\Bin\DCC32.EXE ' +'"'+( Edit1.Text) +'"' +' -u"' ; for I := 0 to memoPath.Lines.Count-1 do DosCommand1.CommandLine:=DosCommand1.CommandLine+ ExtractShortPathName(memopath.Lines[i])+ ';'; DosCommand1.CommandLine:=DosCommand1.CommandLine+'" -Q' ; end; 1: begin //Delphi10.3 DosCommand1.CommandLine := 'C:\Program Files (x86)\Embarcadero\Studio\20.0\bin\dcc32.exe -NS"Vcl;vcl.imaging;system;Winapi" ' +'"'+( Edit1.Text) +'"'+' -u"' ; for I := 0 to memoPath.Lines.Count-1 do DosCommand1.CommandLine:=DosCommand1.CommandLine+ ExtractShortPathName(memopath.Lines[i])+ ';'; DosCommand1.CommandLine:=DosCommand1.CommandLine+'" -Q' ; end; end; // end of case Memo1.Lines.Clear; DosCommand1.OutputLines := Memo1.Lines; //DOS命令的输出 信息 DosCommand1.Execute; //执行命令end;