Re: Computer Name by Ralph
Ralph
Mon Feb 09 05:32:38 CST 2004
Option Explicit
Dim WSHShell, RegKey, ComputerName
Set WSHShell = CreateObject("WScript.Shell")
RegKey =
"HKLM\System\CurrentControlSet\Control\Computername\ActiveComputerName\"
ComputerName = WSHShell.RegRead(RegKey & "Computername")
WScript.echo "ComputerName: " & ComputerName
' End code
On Sun, 8 Feb 2004 21:13:47 -0700, "Al Dunbar [MS-MVP]"
<alan-no-drub-spam@hotmail.com> wrote:
>
>"John Wood" <jwood@hotmail.com> wrote in message
>news:5HDVb.14117$QX4.2700@clgrps13...
>> I would like to read the Computer Name from the registry other than the
>SET
>> command to show %COMPUTERNAME%. Is there anyway to do it ? Which one is
>it
>> ?
>
>Both methods are yucky. Why not do it this way:
>
>Set WNO = CreateObject("Wscript.Network")
>msgbox WNO.computername
>
>
>/Al
>
>