Redirection in DOS is typically done using a 'pipe', which is accomplished
by placing a | (it is next to the backspace on the keyboard) between the
commands. To find files from a DIR command, use:
DIR /s command.com | find /i "COMMAND"
The find portion is case sensitive. Use the /i switch to turn case
sensitivity off.
This form is not very useful because you don't get the folder name on the
screen.
In dos 6 and earlier, there was a verbose form of chkdsk. The command
chkdsk /v |find "COMMAND"
would display the full path of every occurrance of the file command.com,
like this
C:\COMMAND.COM
C:\WINDOWS\COMMAND.COM
C:\WINDOWS\COMMAND\EBD\COMMAND.COM
To do the same thing in DOS 7, use this command:
DIR /b /s command.com | find /i command.com
Try this command line from the c:\ prompt in a dos box to see how it works.
If you want to save the list of files found, you can add the >myfiles.dat
suggestion from Marty's reply below to the end of the command. Like this:
DIR /b /s command.com | find /i command.com >myfiles.dat
Tom Turak
-----Original Message-----
From: Marty Landman [mailto:[log in to unmask]]
Sent: Sunday, June 16, 2002 7:36 PM
At 12:25 PM 6/16/02 -0400, Ian Carmichael wrote:
>You can add the set dircmd command to your autoexec.bat. The DOS FIND
>command doesn't actually search for a particular file, but searches for
>strings within a specified file.
You can get it looking for files too by redirecting the output of a dir cmd
to a file and then doing the find on that file, like so:
dir /s \ >myfiles.dat
find /i "filename.typ" myfiles.dat
These two cmds will first create myfiles.dat on your current directory
containing all the files on your system, and then look for the specified
filename "filename.typ" ignoring case. The flaw here though is that you
won't know what directory the file, if found is in unless you eyeball
myfiles.dat. So you might as well just create myfiles.dat as the output of
the dir cmd as in the first line and then look with a text editor.
If you wanted a solution to this you could automate, i.e. a program; well
personally that's when I decided to install the Java developer's kit. Not
to mention C++.
Marty
--
SIMPL WebSite Creation: http://face2interface.com/Home/Demo.shtml
"Hold No Punches.." Rode brings you great shareware/freeware
programs with his honest opinions in this weekly column.
http://freepctech.com/rode
PCSOFT maintains many useful files for download
visit our download web page at:
http://freepctech.com/downloads.shtml
|