Use a batch file to search from command prompt

If you ever have the need to search for a file from Windows NT Workstation 4.0's command prompt. Well if you do here is a batch file that will do just that.  USe notepad to create the file and save as comsearch.bat and save it into C:\WINNT.

@ECHO OFF
REM ***** COMSEARCH.BAT *****
REM This batch file searches for files, giving file sizes and paths.
REM Wildcards may be used.
CLS
ECHO LOOKING FOR %1...
REM In the following FOR line the letters within the parentheses
REM indicate the drives that are searched.
FOR %%D IN (C D E) DO DIR %%D:\%1/S/P

To use do the following from the command prompt.  For example to search for a file called doc1.xxx, at the Command Prompt, enter comsearch  doc1.xxx and press enter.

If you change the letters within the parentheses, the batch file can search all the drives or just certain ones. These batch file variations could be named wheresc.bat, wheresd.bat, and so on, to look for files in drives C:, D:, and so on." 

 

Win NT Index

Main Index

Search RD Techbase