Does this work for you:
program project6;
{$mode objfpc}{$H+}
{$APPTYPE CONSOLE}
{$codepage utf-8}
uses
Windows;
var
PreviousValue: UINT;
s: String;
c: DWORD;
begin
PreviousValue := GetConsoleOutputCP;
//Using UTF8
if not SetConsoleOutputCP(CP_UTF8) then
begin
WriteLn('SetConsoleOutputCP(CP_UTF8) Failed!');
exit;
end;
S := 'Το πραγραμμα εκτελεστηκε επιτυχως!Πατηστε οποιοδηποτε κουμπι για εξοδο';
if not WriteFile(StdOutputHandle,s[1],Length(s),c,nil) then
WriteLn('WriteFile Failed! ');
{$ifdef FPC_HAS_CPSTRING} //<--- Based on your compiler
if GetTextCodePage(Output)<>StringCodePage(s) then
SetTextCodePage(Output, StringCodePage(s));
{$endif FPC_HAS_CPSTRING}
//WriteLn(s);
SetConsoleOutputCP(PreviousValue);
end.