[Lazarus] Finding out the Hostname of the Computer.

Vincent Snijders vincent.snijders at gmail.com
Thu Nov 27 19:28:15 CET 2008


Dave Coventry schreef:
> Hi,
> 
> I'm trying to get the name of the computer my app is running on.
> 
> I've tried this:
> 
> 

> I'm not sure if it works under Windows, but running Ubuntu, it returns
> '$HOSTNAME'.
> 
> Can anyone see what I'm doing wrong, or offer an alternative way of
> getting the name of the computer?

$HOSTNAME is replace by the shell, so it only happens if let the shell 
execute the command.

In this case GetEnvironmentVariable('HostName') (from the sysutils unit 
would be a lot easier.

Vincent



More information about the Lazarus mailing list