0

I am using Windows Server 2008 and I need to create a Batch file (.bat) to search for a given string in 20.000 to 30.000 files located all in one folder in the same level (without subfolders).

I have been searching and reading around but I couldn't find anything to do it.

Trying it with this without success:

@echo off for /r "delims=|" %%i in (*) do  (    
    findstr /m /C:"34444" %%i

)
2
  • This should point you at the commandline tools you'd need to use, depending on what you're looking for it should only take one command, shouldn't need a batch file: superuser.com/questions/300815/… Jan 15, 2014 at 13:01
  • I have updated the question.
    – Alvaro
    Jan 15, 2014 at 13:07

1 Answer 1

1

From batch

START cmd.exe /k "Findstr -m "34444" *.*"

From command line

Findstr -m "34444" *.*"

also from powershell, create named batch file *.cmd extension containing following content. (remember to change the gci path 'your folder path'.

@PowerShell -ExecutionPolicy Bypass -noexit -Command Invoke-Expression $('$args=@(^&{$args} %*);'+[String]::Join(';',(Get-Content '%~f0') -notmatch '^^@PowerShell.*EOF$')) & goto :EOF
gci -path 'c:\your folder path\' -fi '*' | Select-String -patt "34444" | select Filename, LineNumber | Format-Table -a

call batch file *.cmd to run the powershell search.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.