Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

)
share|improve this question
    
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/… –  Tim Radcliffe Jan 15 at 13:01
    
I have updated the question. –  Alvaro Jan 15 at 13:07
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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