Here’s a quick code scrap to return the Machine Name for a Windows system on a local network using the Windows Command Line.
nbtstat -a <ip address>
This will return output from the Windows NetBIOS record for the machine and should produce a printed table. There can sometimes be a few different values returned, but the entry with “20” in the name should be the name of the machine in question.
The above is only likely to work if you’re on the same local Intranet of the target machine. If you’re trying to do Reverse Lookup for Global IP addresses or non-Windows machines on the local network, you need to look at using nslookup <ip address>.