Files & Directories

Searching

where searches directories that are defined in the PATH environment variable.

# cmd only
where cmd.exe

If what we are searching is elsewhere, we must define the path to start searching for and add /R for recursiveness.

where /R c:\users\ text.txt

find is used to search for strings within a file or output. The downside is that cannot take wildcards or regex.

# cmd only
find "string" file.txt
# lines that do NOT match
find /V "string" file.txt
# case insensitive
find /I "string" file.txt
# display line numbers
find /N "string" file.txt

findstr is an upgrade from find as it accepts regex patterns. Similar to grep for Linux.

findstr "name" test.txt

Sorting

Prior comparing data, it is best to first sort them.

Comparing

fc differs with comp as it shows which lines are different instead of individual characters.

Last updated