how to identity my pc

BlitzMax Forums/BlitzMax Beginners Area/how to identity my pc

Panno(Posted 2008) [#1]
i need a way to get the computername or the mac adress .
it must works on win/linux and hopefully mac


plash(Posted 2008) [#2]
Windows:
Print getenv_("username")
Edit: This returns the current username on Windows, NOT the Computer-Name.

Not sure about the others.


grable(Posted 2008) [#3]
This should give you the computer-name on all platforms:
Print HostName(0)



plash(Posted 2008) [#4]
Using getenv_() I got my actual computer name 'Tim', using HostName(0) I got 'tim-main' - which is my network name. Something doesn't seem right.


grable(Posted 2008) [#5]
using getenv_() I got my actual computer name 'Tim', using HostName(0) I got 'tim-main' - which is my network name. Something doesn't seem right.

I thought "computer name" and "hostname" were the same thing... ?
Getting the username wouldnt allow you to identify the computer anyway, you need the hostname (multiple users and all).


Dabhand(Posted 2008) [#6]
They are...


plash(Posted 2008) [#7]
not.

I don't know why hostname is getting my network name. If I go My Computer->Computer Name->'Change...' it shows 'tim-main' and my windows login username is 'Tim'.

Getting the username wouldnt allow you to identify the computer anyway, you need the hostname (multiple users and all).
No, hostname would not work, I could simply change my 'computer name' to whatever I want and whatever hes using hostname for would be broken. Best bet is to get the MAC address.


Yan(Posted 2008) [#8]
Sweet baby Jebus!


GfK(Posted 2008) [#9]
I don't know why hostname is getting my network name.
Because they're the same thing!

If you want to get your user account name, that's another matter entirely.

Grable's reply is the correct solution to the original problem.


Dabhand(Posted 2008) [#10]
They are...

:P