1.

Solve : findstr search specific file types?

Answer»

I am trying to search for a specific string in certain type of files.  The problem is that below CODE is also showing me files that contains names like aaa.bat_new, aaa.cmd_20150512, etc.  How do I tell it to only search files ending in .bat and .cmd?
 
Code: [Select]findstr /S /I d\^: *.bat *.cmdI don't see a search string there, also what does d\^: do?I am search for anything that contains d: which is my d-drive.  The \^ sign is required to search for the colon.  I am getting what I WANT EXCEPT it is returning filenames that does not end in .bat nor .cmd.What string are you searching for in the files?
I am searching for the string "d:" only in files that have an extension of .bat or .cmd. 

The problem is that there are files which have a hard-coded path for programs which may not be in the expected location when upgrading the OS from Win 2003 to Win 2008.  I just want to MAKE sure nothing has been missed. Quote from: et_phonehome_2 on May 27, 2015, 01:16:26 PM

I am searching for the string "d:" only in files that have an extension of .bat or .cmd. 

Try this.

findstr /s "d:" *.bat *.cmd

 If you want to find d: and also D: then place an /i switch before the QUOTED string like this

findstr /s /i "d:" *.bat *.cmdThanks alot, that worked.....


Discussion

No Comment Found