Page 1 of 1

findstr and full path

Posted: 10 Dec 2020 02:32
by Hatschi
Hello, I have the following batch command:

Code: Select all

findstr /D:%UserProfile%\AppData\local\test /s /i /m /o /OFFLINE /G:"Hit.txt" *.*
I search in all files in this path for words that are in the hit.txt. It works great too, but the full path of the file
is not displayed. As soon as a hit is found i would like to have the complete path. Does somebody has any idea?

Thx
Betty

Re: findstr and full path

Posted: 10 Dec 2020 11:08
by aGerman
It'll help if you omit option /D here. Instead prepend the path to your search pattern. FWIW %UserProfile%\AppData\local should be the same as %localappdata%. And it's just best praxis to enclose file names and paths into quotes.

Code: Select all

findstr /s /i /m /o /offline /g:"Hit.txt" "%localappdata%\test\*.*"
Steffen