1.

Solve : Extract network alias in batch file?

Answer»

I am trying to use the hostname as a conditional in a batch file.  I would like to use the alias (not %COMPUTERNAME% mind you) I added to the hosts file and have to make no other CHANGES (i.e. set an env var at startup).  This would be equivalent to doing a "hostname -a" in UNIX and greping for the alias name.  I haven't found any EVIDENCE that parsing exists using batch so I guess I just need a command that will return that alias.  Is it out there or any nifty WORK arounds?

ThanksIm not a network guru, but if the %computename% provides the name and alias you might be able to extract the alias using the expanded SET command.



Discussion

No Comment Found