The topic of “Search function in Vista” was brought up on the Minasi Forum. (NOTE! if you are not a member you should be) The DIR /S command was brought up as a replacement option to use since the old method that existed in XP is no longer available. I remembered reading this article in WIN IT PRO and thought that it may be very useful for what the Admins are trying to accomplish.
I often find it useful to search for files from a command line. In the past, I’ve typically used Cmd.exe’s dir command with the /b and /s parameters to search for files; combining these parameters provides a list containing the full paths and filenames of matching files. However, dir doesn’t have a simple syntax for searching multiple locations. For example, to search drives C and D for all files ending in .doc, you would use this command:
dir /b /s c:\*.doc d:\*.doc
The syntax gets even more complex when searching for multiple wildcard patterns (e.g., all .doc, .xls, and .ppt files) in multiple locations because you have to type each location and each wildcard pattern separately.
Windows PowerShell’s Get-ChildItem cmdlet makes this task simpler. For example, to search drives C and D for all .doc, .xls, and .ppt files, you can use this command:
-include *.doc,*.xls,*.ppt -recurse
Get-ChildItem’s first parameter is a list of paths to search, and the -Include parameter specifies a list of wildcard patterns that qualify the paths. The -Recurse parameter is analogous to the dir command’s /s parameter.