How to search for a phrase in a file

D

David

In windows XP's search options you could use the option to find a phrase
within a set of files.
I want to search all .bat files for the phrase "Z:"
How do I do this in vista?
 
J

Joseph Meehan

David said:
In windows XP's search options you could use the option to find a phrase
within a set of files.
I want to search all .bat files for the phrase "Z:"
How do I do this in vista?

I have not played with it in Vista yet, it appears to me to look a
little different, but with the same features. Try holding the windows key
and pressing the "F" key.
 
G

Gene E. Bloch

In windows XP's search options you could use the option to find a phrase
within a set of files.
I want to search all .bat files for the phrase "Z:"
How do I do this in vista?

Vista search has a fair amount of power, but it seems to be poorly
documented. Is this an understatement? Even two (non-MS) books that I
bought are not helpful...

If indexing is on, Vista searches for contents as well as names. Here's
what I just did: in the search bar, I typed "ext:doc AND smith" (wihtout
the quotes) and I found a list of my doc files that have the word smith in
them.

So, if your bat files are indexed, you could type "ext:bat AND z:". This
should work, unless Vista gets all huffy about z: being a drive name (and
of course the colon is a delimiter in this situation).

....Well, I just tested it. Vista seems not to understand the colon.

Next alternative: download the free search program 'Agent Ransack' and use
it. People here love it. I don't *love* it, but it has helped me a few
times. And it does the job you asked for (I just tested it to make sure).
 
D

Dave Cox

Vista search has a fair amount of power, but it seems to be poorly
documented. Is this an understatement? Even two (non-MS) books
that I bought are not helpful...

If indexing is on, Vista searches for contents as well as names.
Here's what I just did: in the search bar, I typed "ext:doc AND
smith" (wihtout the quotes) and I found a list of my doc files
that have the word smith in them.

So, if your bat files are indexed, you could type "ext:bat AND
z:". This should work, unless Vista gets all huffy about z: being
a drive name (and of course the colon is a delimiter in this
situation).

...Well, I just tested it. Vista seems not to understand the
colon.

Next alternative: download the free search program 'Agent Ransack'
and use it. People here love it. I don't *love* it, but it has
helped me a few times. And it does the job you asked for (I just
tested it to make sure).

I just typed "*.txt AND 452B" in the start search and it found a
text file with 452B in it.

Should work with a .bat file if indexing is on.
 
R

richard.williams.20

In windows XP's search options you could use the option to find a phrase
within a set of files.
I want to search all .bat files for the phrase "Z:"
How do I do this in vista?

When Vista files are NOT indexed, use the following in biterscripting
(http://www.biterscripting.com/install.html for free download) .

script SS_FindStr.txt files("*.bat") dir("C:/Program Files") str("Z:")

Will list all .bat files showing line numbers and line text containing
the string "Z:" .

To search by REGULAR EXPRESION instead of string, use the following.

script SS_FindRE.txt files("*.bat") dir("C:/Program Files") str
(<reg_expr>)

Avoid searching directly into C:/ - it will be slow - operating system
"holds" some of the files.

These scripts work in all Windows versions, and irrespective of
whether files are indexed or not.

Take care.

Richard
 
G

Gene E. Bloch

I just typed "*.txt AND 452B" in the start search and it found a
text file with 452B in it.

Should work with a .bat file if indexing is on.

Weird. I had been unable to succeed with "*.txt" or whatever before (in
Windows Explorer in Vista), so I was happy when I stumbled onto the syntax
"ext:txt".

Then I get a reply from you that makes a liar (OK, a confused person!) out
of me - so I tested "*.txt" and it worked. What's going on here? :)

I guess I might have found a setting to enable regular expressions (or at
least wild cards), changed it, and then forgot - or somehow changed it
unconsciously. Or there's no such setting, and I just managed to screw up
before. One of life's little mysteries...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top