Code: Select all
224.0.0.0
Code: Select all
netstat -rn | findstr "0.0.0.0"
Moderator: DosItHelp
Code: Select all
224.0.0.0
Code: Select all
netstat -rn | findstr "0.0.0.0"
Code: Select all
c:\>netstat -rn|findstr "0.0.0.0"
0.0.0.0 0.0.0.0 192.168.8.1 192.168.8.108 25
224.0.0.0 240.0.0.0 On-link 127.0.0.1 331
224.0.0.0 240.0.0.0 On-link 192.168.8.108 281
Code: Select all
c:\>netstat -rn|findstr /L /C:" 0.0.0.0"
0.0.0.0 0.0.0.0 192.168.8.1 192.168.8.108 25
Code: Select all
findstr /?
Code: Select all
netstat -rn | findstr /C:"0.0.0.0"
0.0.0.0 0.0.0.0 10.12.70.65 10.12.70.66 281
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.236 50
224.0.0.0 240.0.0.0 On-link 127.0.0.1 331
224.0.0.0 240.0.0.0 On-link 169.254.71.163 281
224.0.0.0 240.0.0.0 On-link 10.12.70.66 281
224.0.0.0 240.0.0.0 On-link 192.168.1.236 306
0.0.0.0 0.0.0.0 10.12.70.65 Default
You missed what miskox said about putting a space before the first 0 in your findstr command. It should be like this:lazna wrote: ↑23 Nov 2022 11:50expect only three lines containing pattern, but got more lines
Code: Select all
netstat -rn | findstr /C:"0.0.0.0" 0.0.0.0 0.0.0.0 10.12.70.65 10.12.70.66 281 0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.236 50 224.0.0.0 240.0.0.0 On-link 127.0.0.1 331 224.0.0.0 240.0.0.0 On-link 169.254.71.163 281 224.0.0.0 240.0.0.0 On-link 10.12.70.66 281 224.0.0.0 240.0.0.0 On-link 192.168.1.236 306 0.0.0.0 0.0.0.0 10.12.70.65 Default
Code: Select all
netstat -rn|findstr /L /C:" 0.0.0.0"
netstat -rn | findstr /C:" 0.0.0.0"
Code: Select all
netstat -rn | findstr /R "\<0.0.0.0"
Code: Select all
@echo off
Title Get Default Gateway and Local IP Address from netstat command
@for /f "tokens=3,4 delims= " %%a in ('netstat -rn ^| findstr "\<0.0.0.0"') do (
Set "Gateway=%%a"
Set "MyIP=%%b"
)
echo( Gateway = %Gateway%
echo( MyIP = %MyIp%
pause