Hi, Under Windows GetEnvironmentVariable(AnsiString) uses the winapi function GetEnvironmentStringsA. Why not simply: Result:=String(GetEnvironmentVariable(UnicodeString(EnvVar))); ? This would save some code and would work with another DefaultSystemCodepage as well. Mattias