MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
April
Sun Mon Tue Wed Thu Fri Sat
  1
       
2024
Months
Apr
Nov Dec


Mon, Apr 01, 2024 10:10 pm

Determining the default gateway and subnet mask from a Windows command prompt

From a command prompt on a Microsoft Windows system, you can obtain details on the network configuration by issuing the command ipconfig or ipconfig /all, if you wish to see more details. If you are only interested in a specific value or values, though, you can pipe the output of the command to the findstr command. If you wish to see multiple values, e.g., the subnet mask and the default gateway address, you can put text associated with both values, separated by a space, within double quotes. Findstr will treat the space between strings as instructing it to perform a logical OR operation, i.e., it will find any lines that contain either of the strings. Findstr uses a case sensitive search, so you need to either match the case of the text or use the /i option with findstr, which instructs it to ignore the case of text and perform a case insensitive search.

C:\>ipconfig | findstr "Mask Gateway"
   Subnet Mask . . . . . . . . . . . : 255.255.255.224
   Default Gateway . . . . . . . . . : 192.168.1.1

C:\>ipconfig | findstr "mask gateway"

C:\>ipconfig /all | findstr /i "mask gateway"
   Subnet Mask . . . . . . . . . . . : 255.255.255.224
   Default Gateway . . . . . . . . . : 192.168.1.1

C:\>

You can also use a Windows Management Instrumentation Command-line (WMIC) command to obtain the same information.

C:\>wmic nicconfig get defaultIPGateway, IPSubnet
DefaultIPGateway  IPSubnet

{"192.168.1.1"}   {"255.255.255.224", "64"}












C:\>

[/os/windows/commands] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo