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;