本文整理自网络,侵删。
procedure TForm1.Button2Click(Sender: TObject);var OutPutDemo: String; Buffer: TStringStream;begin OutPutDemo := '@echo off ' + #13#10+'setlocal EnableDelayedExpansion ' + #13#10+'set "CSI=[" ' + #13#10+'echo/ ' + #13#10+'echo Ansi color table of console text colors ' + #13#10+'echo/ ' + #13#10+'echo ^| -^> Foreground light colors ' + #13#10+'echo ^| ' + #13#10+'for /L %%b in (40,1,47) do ( ' + #13#10+' set "line=%CSI%%%b;30m%%b30" ' + #13#10+' for /L %%f in (31,1,37) do set "line=!line!%CSI%%%b;%%fm %%b%%f" ' + #13#10+' for /L %%f in (30,1,37) do set "line=!line!%CSI%%%b;%%f;1m %%b%%f" ' + #13#10+' echo !line! ' + #13#10+') ' + #13#10+'echo/ ' + #13#10+'for /L %%b in (40,1,47) do ( ' + #13#10+' set "line=%CSI%%%b;5;30m%%b30" ' + #13#10+' for /L %%f in (31,1,37) do set "line=!line!%CSI%%%b;5;%%fm %%b%%f" ' + #13#10+' for /L %%f in (30,1,37) do set "line=!line!%CSI%%%b;5;%%f;1m %%b%%f" ' + #13#10+' echo !line! ' + #13#10+') ' + #13#10+'echo/ ' + #13#10+'pause ';
if not FileExists(ExtractFilePath(ParamStr(0))+'colors.cmd') then begin Buffer := TStringStream.Create; try Buffer.WriteString(OutPutDemo); Buffer.SaveToFile(ExtractFilePath(ParamStr(0))+'colors.cmd'); finally Buffer.Free; end; end;
WinExec(PAnsiChar('cmd /c colors.cmd'), SW_SHOWNORMAL);end;
相关阅读 >>
Delphi tms web core messagedlg对话框用法
Delphi中sendmessage给一个edit控件发送wm_settext消息
Delphi 判断iso文件,iso文件头, iso filehead
更多相关阅读请进入《Delphi》频道 >>