Getting computer name

B

Bob Woodward

I need to be able to identify which computer a program is
running on from within a database program. I can shell
out to a command prompt and capture output then parse the
response but the trick I seem to be having a hard time
with is I need to get the name without using DNS,
hence "ping localhost" won't work since DNS can be wrong.
Also, I need the solution to not require writing any kind
of additional program or script. I need a standard
command that comes with Win2k/WinXP/Win2k3.

TIA.
 
B

Bill Stewart

Bob said:
I need to be able to identify which computer a program is running on
from within a database program. I can shell out to a command prompt
and capture output then parse the response but the trick I seem to be
having a hard time with is I need to get the name without using DNS,
hence "ping localhost" won't work since DNS can be wrong. Also, I
need the solution to not require writing any kind of additional
program or script. I need a standard command that comes with
Win2k/WinXP/Win2k3.

Hi,

Will the %COMPUTERNAME% environment variable do the trick?

Bill
 
G

Guest

-----Original Message-----


Hi,

Will the %COMPUTERNAME% environment variable do the trick?

Bill
.
This might be a usable option but I'd love to find others.
I did verify that each time I shell out, this variable is
refreshed so it should be reliable enough. Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top