Windows CMD:Finding Files and Counting Lines

systems Add comments

Finding files

C:\> cd c:\windows\system32
C:\> dir /s /b wmic.exe

C:\> dir /s /b c:\windows\system32\wmic.exe

It looks like this command would only find a wmic.exe if it is system32 itself, but it actually looks through system32 and all of its subdirectories

C:\> dir /s /b c:\windows\system32 | find “wmic.exe”

Counting lines

There is no wc command built in, but here is a method I use:

C:\> dir /b c:\temp | find /c /v “~~~”

C:\> tasklist /fi “imagename eq svchost.exe” | find /c /v “~~~”

C:\> type c:\windows\win.ini | find /c /v “~~~”

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in