find command in windows

Dear Experts,

Please tell me what is the equivalent command of

find . -name "*.txt" -print

which prints the all the text files in all the folders and sub folders in case of unix.
in windows how can i achieve the same output in windows please inform and also

find . -name "*.txt" -print| while read obj
do
echo $obj
done

in unix , i want to achieve this in windows how it is possible please inform.

The first I know

dir /s *.txt

You can do basic piping like

dir /s *.txt | more

You can use a basic loop with labels and a for loop, but anything more than that you are going to need powershell.
But what do I know, this is a Unix forum :slight_smile:

Alternatively you could use uwin or cygwin so you can run some unix commands on a windows platform.

Without Powershell you can simulate unix "find" and output only the full hierarchial names of files found.

This is a MSDOS Batch file of type ".bat" (e.g. findtxt.bat).

@echo off
set START="C:\"
for /R %START% %%f in (*.txt) do (echo %%f)

Note: The value of variable "START" can be "." (like in unix "find").

Footnote: Most Windows MSDOS "dir" versions can output the same bare list of filenames.

dir C:\*.txt /a:-d /b /s