WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Get IP Address

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

IP Configuration for Windows NT

Keywords:     IPCONFIG

Question:

I am trying to extract the IP information (address and Gateway) from an NT machine. I saw the posting for Windows 95 using the WINIPCFG command and it works great under 95. Unfortunately NT uses a DOS window to display the IP configuration and I have not been able to extract the information.

Answer:

  1. Even easier under NT, just use the IPCONFIG.EXE command with all it's options. Try IPCONFIG /? to see them all, but all this information is attainable including DHCP info.

  2. Using the Internet extender, there is a cute way to get the local ip address by using the wxGetInfo commands. Best way I've seen yet.

  3. Regular Winbatch method:

    Try this code below. It will extract all IP information from the registry from nt40

    IPRegKey=RegOpenKey(@REGMACHINE,"System\CurrentControlSet\Services\E100B1\Parameters\TCPIP")
    TCPIP=RegQueryMulSz(IPRegKey,"[IPAddress]",@tab)
    Gateway=RegQueryMulSz(IPRegKey,"[DefaultGateway]",@tab)
    SubNet=RegQueryMulSz(IPRegKey,"[SubnetMask]",@tab)
    RegCloseKey(IPRegKey)
    
    HostName =RegQueryValue(@REGMACHINE,"System\CurrentControlSet\Services\TCPIP\Parameters[Hostname]")
    DNS =RegQueryValue(@REGMACHINE,"System\CurrentControlSet\Services\TCPIP\Parameters[NameServer]")
    DNSDOM =
    RegQueryValue(@REGMACHINE,"System\CurrentControlSet\Services\TCPIP\Parameters[Domain]")
    USEDNS =RegQueryDword(@REGMACHINE,"System\ControlSet001\Services\NetBT\Parameters[EnableDNS]")
    
    If USEDNS == "1" 
    USEDNS = "Yes"
    EndIF
    

Article ID:   W12655
Filename:   Get IP Address Windows NT4.0.txt
File Created: 1999:04:15:16:48:42
Last Updated: 1999:04:15:16:48:42