F5F Stay Refreshed Power Users Networks Do you actually NEED an EZ Network Scanner?

Do you actually NEED an EZ Network Scanner?

Do you actually NEED an EZ Network Scanner?

D
DanBarr2
Member
138
07-24-2026, 11:08 PM
#1
I made a funny little script to check the connections on your computer network. It shows you the Process ID and which service is using that connection. This thing will change itself every ten seconds so you can see your network working live. To make this work, open Notepad on Windows 10, save it as an .bat file, and put all these words inside:

@Echo off
cd /d C:\Windows\System32
for /f "tokens=5" %%a in ('netstat -ano ^| findstr /i "established" ^| findstr /r /c:"[ ][0-9].[0-9].[0-9].[0-9]:[0-9][ ][0-9][ ]*ESTABLISHED") do @(echo PID: %%a & tasklist /svc /fi "pid eq %%a")
timeout /t 5 /nobreak >nul
goto loop
D
DanBarr2
07-24-2026, 11:08 PM #1

I made a funny little script to check the connections on your computer network. It shows you the Process ID and which service is using that connection. This thing will change itself every ten seconds so you can see your network working live. To make this work, open Notepad on Windows 10, save it as an .bat file, and put all these words inside:

@Echo off
cd /d C:\Windows\System32
for /f "tokens=5" %%a in ('netstat -ano ^| findstr /i "established" ^| findstr /r /c:"[ ][0-9].[0-9].[0-9].[0-9]:[0-9][ ][0-9][ ]*ESTABLISHED") do @(echo PID: %%a & tasklist /svc /fi "pid eq %%a")
timeout /t 5 /nobreak >nul
goto loop

K
Komodo88
Senior Member
749
07-25-2026, 02:50 AM
#2
Maybe you should make your code look nice with little lines like `<code>...</code>` instead of just `[]`. This style is okay for the normal stuff.
K
Komodo88
07-25-2026, 02:50 AM #2

Maybe you should make your code look nice with little lines like `<code>...</code>` instead of just `[]`. This style is okay for the normal stuff.

J
JR_GAMER07
Posting Freak
915
07-25-2026, 03:27 AM
#3
It doesn't look like this works. There is an invalid argument error. The folder path for c:\Users\REDACTED\Desktop shows 274 test.bat files, which total 274 bytes and have a disk space of 79,053,303,808 bytes free on the drive. Running the command netstat -ano | findstr /i "established" in that folder did not work as expected because it is missing the proper argument for that tool. The correct way to run this tool is with a flag named '/t', but I typed 'test.bat off' instead of that. If you try using just 'netstat -ano', then it works fine and gives useful output. Also, when running scripts in Windows Command Line, please use the REM command to comment your lines so they are ignored by the system. Each line needs an explanation on what it does because very few people will blindly copy and run a script without looking at it first. I ran this test just as a precautionary measure before sending it out for you to check. = = = = @klavs Something seems to be missing from your message.
J
JR_GAMER07
07-25-2026, 03:27 AM #3

It doesn't look like this works. There is an invalid argument error. The folder path for c:\Users\REDACTED\Desktop shows 274 test.bat files, which total 274 bytes and have a disk space of 79,053,303,808 bytes free on the drive. Running the command netstat -ano | findstr /i "established" in that folder did not work as expected because it is missing the proper argument for that tool. The correct way to run this tool is with a flag named '/t', but I typed 'test.bat off' instead of that. If you try using just 'netstat -ano', then it works fine and gives useful output. Also, when running scripts in Windows Command Line, please use the REM command to comment your lines so they are ignored by the system. Each line needs an explanation on what it does because very few people will blindly copy and run a script without looking at it first. I ran this test just as a precautionary measure before sending it out for you to check. = = = = @klavs Something seems to be missing from your message.

C
cactusgaming1
Junior Member
24
07-25-2026, 07:10 AM
#4
Your test.bat file only contains variables named a, so it can't see other things like the folder or path you are looking for.
C
cactusgaming1
07-25-2026, 07:10 AM #4

Your test.bat file only contains variables named a, so it can't see other things like the folder or path you are looking for.

I
InoueAlice
Senior Member
677
07-26-2026, 09:18 AM
#5
It's because @gmikkonen didn't format his code snippet correctly. I cleaned up and changed it so you can see it better. Here is the text: @echo off @rem cd /d C:\Windows\System32 :loop cls for /f "tokens=5" %%a in ('netstat -ano ^| findstr /r /c:"[0-9]:[0-9].*[0-9]:[0-9].*ESTABLISHED") do @(tasklist /svc /fi "pid eq %%a") ^| findstr /r /c:"[0-9]" timeout /t 5 /nobreak >nul goto loop The OP told you to save the file with a .bat extension or change it to .cmd. It's not a network scanner, it just shows which connections are active right now.
I
InoueAlice
07-26-2026, 09:18 AM #5

It's because @gmikkonen didn't format his code snippet correctly. I cleaned up and changed it so you can see it better. Here is the text: @echo off @rem cd /d C:\Windows\System32 :loop cls for /f "tokens=5" %%a in ('netstat -ano ^| findstr /r /c:"[0-9]:[0-9].*[0-9]:[0-9].*ESTABLISHED") do @(tasklist /svc /fi "pid eq %%a") ^| findstr /r /c:"[0-9]" timeout /t 5 /nobreak >nul goto loop The OP told you to save the file with a .bat extension or change it to .cmd. It's not a network scanner, it just shows which connections are active right now.

Q
QuarryZach
Junior Member
5
07-26-2026, 03:22 PM
#6
@klavs Thanks a bunch. @MrLitschel - cool thing. Not sure why one of those "%"s is missing on this side. Pasted the whole line over and over again. Everything else after the first % disappears when that error pops up. I'm wondering... Will check it out later. = = = = FYI everyone, Have you tried or used PowerShell before? If not, I'd recommend it, especially if you're into IT stuff.
Q
QuarryZach
07-26-2026, 03:22 PM #6

@klavs Thanks a bunch. @MrLitschel - cool thing. Not sure why one of those "%"s is missing on this side. Pasted the whole line over and over again. Everything else after the first % disappears when that error pops up. I'm wondering... Will check it out later. = = = = FYI everyone, Have you tried or used PowerShell before? If not, I'd recommend it, especially if you're into IT stuff.

L
Lineheads
Member
51
07-31-2026, 06:56 PM
#7
It won't work like a CMD batch extension because it's not designed for that. When you write @Echo off at the top, the script hides its own commands from showing up on screen, which makes everything look cleaner. The command cd /d C:\Windows\System32 changes where we are working to a folder full of Windows system files. Then the label for.cls tells us to clear the screen first so when we start again it looks fresh. For /f with tokens=5 loops through the netstat output looking specifically for lines like [ ][0-9].[0-9].[0-9].[0-9]:[0-9][ ][0-9][ ]*ESTABLISHED to find established connections. It then uses tasklist /svc and /fi flags to show details about which processes have those active connections. The timeout command waits for five seconds before starting the next check, but /nobreak stops it from stopping if you press a key. This line just jumps back up to the loop label so it keeps going over and over again finding these running processes every single five seconds.
L
Lineheads
07-31-2026, 06:56 PM #7

It won't work like a CMD batch extension because it's not designed for that. When you write @Echo off at the top, the script hides its own commands from showing up on screen, which makes everything look cleaner. The command cd /d C:\Windows\System32 changes where we are working to a folder full of Windows system files. Then the label for.cls tells us to clear the screen first so when we start again it looks fresh. For /f with tokens=5 loops through the netstat output looking specifically for lines like [ ][0-9].[0-9].[0-9].[0-9]:[0-9][ ][0-9][ ]*ESTABLISHED to find established connections. It then uses tasklist /svc and /fi flags to show details about which processes have those active connections. The timeout command waits for five seconds before starting the next check, but /nobreak stops it from stopping if you press a key. This line just jumps back up to the loop label so it keeps going over and over again finding these running processes every single five seconds.

C
coolman9222
Posting Freak
754
08-01-2026, 01:07 AM
#8
CMD works with BAT, which was common back in DOS when we used 16-bit systems. If you haven't formatted your code properly, it's very hard to read. You should look at your own post and add a comment there instead. I already told you to use the CODE tag so things are clearer. Here is how I did it: https://imgur.com/a/mE7yxMz Check out this image for more details too: https://imgur.com/a/mE7yxMz
C
coolman9222
08-01-2026, 01:07 AM #8

CMD works with BAT, which was common back in DOS when we used 16-bit systems. If you haven't formatted your code properly, it's very hard to read. You should look at your own post and add a comment there instead. I already told you to use the CODE tag so things are clearer. Here is how I did it: https://imgur.com/a/mE7yxMz Check out this image for more details too: https://imgur.com/a/mE7yxMz

R
208
08-02-2026, 07:49 PM
#9
Command: @echo off cd C:\Windows\System32 :loop clear screen for each line in ('netstat -ano | findstr "established"') do @(echo PID: number & tasklist service pid equal number) wait 5 seconds then go to next iteration
R
realfuzzpikchu
08-02-2026, 07:49 PM #9

Command: @echo off cd C:\Windows\System32 :loop clear screen for each line in ('netstat -ano | findstr "established"') do @(echo PID: number & tasklist service pid equal number) wait 5 seconds then go to next iteration

O
OmqDace
Posting Freak
798
08-05-2026, 07:29 PM
#10
Nice. Thanks for sending over your script and helping people learn how to write batch scripts. You don't have to change the current working directory to C:\Windows\System32, because that folder is already in the PATH environment variable. There is no need to put a @ symbol before the "tasklist" command, since "echo" has been turned off so it won't print anything else first. To get help with commands, you can write "help <name of command>" or "<name of command> /?". When looking for the word "established", don't ignore capital letters because netstat always shows it in upper case. So, you can remove this statement from your command: Code: ^| findstr /i "established"
O
OmqDace
08-05-2026, 07:29 PM #10

Nice. Thanks for sending over your script and helping people learn how to write batch scripts. You don't have to change the current working directory to C:\Windows\System32, because that folder is already in the PATH environment variable. There is no need to put a @ symbol before the "tasklist" command, since "echo" has been turned off so it won't print anything else first. To get help with commands, you can write "help <name of command>" or "<name of command> /?". When looking for the word "established", don't ignore capital letters because netstat always shows it in upper case. So, you can remove this statement from your command: Code: ^| findstr /i "established"