Alternatively, if you don't want to use a third-party software, you can indeed do this by command-line.
It's kind of a hassle to work with directory names that have a space in it such as C:\Program Files so it's not a simple script, but here it is, worked for me in Windows 7:
@echo off
for /f "tokens=*" %%A in ('dir /b /ad C:\') do (
if "C:\%%A"==%2 (
echo Not scanning %2
) else (
dir /s /b "C:\%%A\%1"
)
)
Usage: file.bat file_to_be_searched.extension "C:\directory\not\to\search"
Note the "" in the directory, you must use it for the script to work.
What this does is:
For each line (all characters) of the output of the command dir /b /ad C:\, which lists the directories in C:\, do:
If C:\directory is your_directory don't scan it. Else, look for the file you specified in it.
Example (I named the scrip search.bat and placed a file named a.txt in C:\Program Files)
C:\Users\XXXX\Desktop>search.bat a.txt "C:\Windows"
File Not Found
File Not Found
File Not Found
File Not Found
File Not Found
C:\Program Files\a.txt
File Not Found
File Not Found
File Not Found
File Not Found
File Not Found
Not scanning "C:\Windows"
You can adapt the script so it doesn't search multiple directories, adding more if statements.
P.S.: I forgot to mention, this will only search the folder on root, that is, C:\. If you want to search the folders in a different location you'll have to adapt the script. Cheers.
searched for text 'goal'. Although it made no difference, it changed the address bar to this :
– happybuddha Mar 06 '13 at 16:41search-ms:displayname=Search%20Results%20in%20System%20(C%3A)&crumb=System.Generic.String%3AGoal&crumb=location:C%3A%5C
Still doesn't serve the purpose
– happybuddha Mar 06 '13 at 16:42