findstr command hangs indefinitely
Hi, I have a very strange problem with the findstr command. Sometimes, for no apparent reason whatsoever, it just hangs indefinitely. Here is an example: Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\svn-checkout\WSSMRA\mrahub\trunk\package_scripts\svn-tagging>findstr /R comment filelist.txt comment=MRA1-000: Release for project XYZ C:\svn-checkout\WSSMRA\mrahub\trunk\package_scripts\svn-tagging>findstr /R comment filelist.txt comment=MRA1-000: Release for project XYZ On the first execution, it finds the line in the file, and completes successfully, returning control to the prompt. On the second execution, it finds the line in the file, but then hangs indefinitely, never returning the control back to the prompt. The file it is reading has not changed, it has not been opened in the meantime, nothing else on the system has changed. The second execution of it was run a couple of seconds later. This also occurs when used in a .bat script - with the result being that the script never finishes. Has anyone ever come across this issue before, or have any ideas what could be the cause? Many thanks Tim
July 26th, 2011 6:58am
Is the error reproducable somehow? What happens when you try same commands again? If findstr hangs, maybe it would be worth to convert your .bat script to powershell, which has more options for parsing text filesWith kind regards Krystian Zieja http://www.projectenvision.com Follow me on twitter My Blog Need help with your systems?
July 26th, 2011 7:10am
It seems to be entirely random - sometimes it works, sometimes it hangs. There is no pattern to it, the only pattern being if you try it enough times then eventually it will just hang. I might try powershell or vbscript instead - thanks for the suggestion. Regards Tim
July 26th, 2011 7:13am
It would be helpful if you can post the full batch file; perhaps something else is causing the hang up? If echo is off findstr isn't necessarily the last command executed despite it being the last shown command on the console.
July 26th, 2011 2:43pm
I have little experience with findstr, but if it helps, I do have a VBScript program I use to find files that contain specified strings (up to 3). The program is linked here: http://www.rlmueller.net/FindFiles.htm The program has never hung for me, and I use it frequently. It skips folders where you lack permissions. Richard Mueller - MVP Directory Services
July 26th, 2011 7:40pm