Getting computer name

  • Thread starter Thread starter Bob Woodward
  • Start date Start date
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.
 
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
 
-----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!
 
Back
Top