findstr and full path

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Posts: 1
Joined: 10 Dec 2020 02:21

findstr and full path

#1 Post by Hatschi » 10 Dec 2020 02:32

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?


Posts: 4043
Joined: 22 Jan 2010 18:01
Location: Germany

Re: findstr and full path

#2 Post by aGerman » 10 Dec 2020 11:08

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\*.*"

Post Reply