How to get fully qualified hostname using Ant
问题 I am using Ant as our setup script for our server, and we need to get the fully qualified name of our server. How can I get it using Ant, or is is possible in Ant? The fully qualified hostname is like: xxx.company.com 回答1: <exec executable="hostname" outputproperty="computer.hostname"/> will work on linux and windows, otherwise use the groovy solution from Marc O'Connor Also nslookup will work on linux and windows, if you need the fullhostname you have to parse for the entry after Name: in