I am running a following command,
@echo off cls for /r D:\ %%a in (*) do if "%%~nxa"=="new.txt" set p=%%~dpnxa if defined p ( echo File found its path - %p% pause ) else ( echo File not found ! pause )
it will search for the file named
new.txt on whole drive
D: folders and sub folders as a final result, it shows the full path of that file
new.txt as an output like below, (lets assume
new.txt file in
File found and its path - D:\folder\new.txt Press any key to continue . . .
But the problem is , if there is multiple file with same name
new.txt in drive
D: on different folder or sub folder , it only shows one path output.
My need is, want to show all files path with the same name
new.txt on drive
D: like below output,
Expected Output need like this,
Files found : 4 Files Paths : 1 - D:\folder\new.txt 2 - D:\new folder\new.txt 3 - D:\files\new.txt 4 - D:\folder\new\new.txt
pls help..Thx in Advance.