Partager via


Streamlined IP Config batch file

Put the following into Notepad and call it IP.bat.  Run it and see what happens.  It is case sensitive.

@ipconfig | find "IP Address"

@ipconfig | find "Default Gateway"

@pause

Comments

  • Anonymous
    October 06, 2004
    How about getting IP info of any computer local or remote that you have access?

    I don't remember where I got this snippet but there are numerous options available.

    Thanks,

    John

    ComputerName = InputBox("Enter the name of the computer you wish to query")

    set IPConfigSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//"& ComputerName &"").ExecQuery("select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")

    for each IPConfig in IPConfigSet

    WScript.Echo "IP Address Info For NIC Index: " & IPConfig.InterfaceIndex

    if Not IsNull(IPConfig.IPAddress) then
    for i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
    WScript.Echo "IPAddress: " & IPConfig.IPAddress(i)
    next
    end if

    if Not IsNull(IPConfig.DefaultIPGateway) then
    for i=LBound(IPConfig.DefaultIPGateway) to UBound(IPConfig.DefaultIPGateway)
    WScript.Echo "Default GateWay: " & IPConfig.DefaultIPGateway(i)
    next
    end if

    WScript.Echo

    next


    D:DataRootOldDataItemsVbscriptWMI>reviewip
    Microsoft (R) Windows Script Host Version 5.6
    Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

    IP Address Info For NIC Index: 2
    IPAddress: 4.5.79.33
    Default GateWay: 4.5.64.1

    IP Address Info For NIC Index: 3
    IPAddress: 10.10.10.10
  • Anonymous
    October 07, 2004
    It's like ipconfig but in fewer lines!!