As the compiler error message indicates, it expects a constant expression in which you initialize const. But you call the function there, and the compiler will not evaluate it at compile time.
Declare a variable instead and assign it inside the regular start block of your code:
var
SMyFile: string;
S: TStringList;
begin
S := TStringList.Create;
try
S.Add('intructions');
SMyFile := GetWindowsSystemDir+'\intructions.txt';
S.SaveToFile(SMyFile);
finally
S.Free;
end;
end;
source
share