You can also do temp:string; setlength(temp,100); //has to be big enough first setlength(temp,getEnvironmentVariable(PChar('USERNAME'),PChar(temp),length(temp))); since the user name is also an environment variable at least since Windows 2000. John