Get windows directory

How to find the path of the windows directory.

function WindowsDirectory : String;

var

  Buffer : Array[0..Max_path] of char;

begin

  FillChar(Buffer,Max_Path + 1, 0);

  GetWindowsDirectory(Buffer,Max_path);

  Result := String(Buffer);

  if Result[Length(Result)] <> '\' then Result := Result + '\';

end;

 

Share this article!

Follow us!

Find more helpful articles: