6.701 bytes

Service Hints & Tips

Document ID: DSET-3FG8LX

PS/1-Aptiva - Can I find a file without knowing which directory it is in?

Applicable to: United States

Often you will know the name of the file that you are looking for but do not know in which directory to find it. Or, you may want to find a listing of all the BAT or all the ZIP files on the disk.

The following batch program uses the DOS ATTRIB command to search for files. Use of this program will allow you to find the directory in which a file resides or gets a list of files and the paths to them when a global search is issued (such as *.BAT).

The batch file can be written in the DOS Editor and saved with the name WHEREIS.BAT. The file should exist in the root directory of the disk on which it will be used.

For example, if you will be using the WHEREIS program to find files on the hard disk, you should have the WHEREIS.BAT file in the root directory of drive C. If you will be using the WHEREIS program to find files on a diskette, you should copy the file to the root directory of the diskette. (The file only takes about 191 bytes.)

After writing and saving the batch file, you can use the program from the YOUR SOFTWARE Main Folder or from the DOS prompt. The following section explains how to create, save, and use the WHEREIS.BAT batch file. We will use the DOS Editor to create the file and the DOS prompt when using the file.



1. Go to a DOS prompt.
2. Enter: EDIT (or E depending on the version of DOS you are using).
3. Type the following lines on the blank screen:

@ECHO OFF
REM WHEREIS.BAT
IF %1!==! GOTO ERR
ECHO Searching for %1
ATTRIB \%1 /S |MORE
GOTO END
:ERR
ECHO Enter the name of the
ECHO file you want to find
ECHO after the %0
:END

4. Click on File from the menu bar and choose Save As (press F2 in E). Enter: C:\WHEREIS.BAT in the File Name box. (Be sure to include the C:\ before the file name and do not press Enter yet!) If you want to save the file to diskette rather than to the hard disk, substitute an A:\ for the C:\ and insert the diskette on which you want to save the file in drive A.

5. Press [Enter] or click on <OK>.
6. Click on File on the menu bar and choose Exit (F3 in E). If you are prompted to save the file, answer No. The Save As command has already saved the file with the name WHEREIS.BAT.

The batch file has now been created, saved, and is ready for use. To use the file, go to the DOS prompt. If you saved the file on a diskette, you should insert the diskette in drive A and enter: A:. Then enter: WHEREIS. You will be taken to the program Options screen. On the options line, you should type the name of the file that you are looking for with its extension, or give a global search variable.

For example, if you know that you have a file called LETTER.WPS but do not know which directory it is in, you would type: LETTER.WPS on the options screen. If you wanted a listing of all the zipped files (with the ZIP extension) on the hard disk or diskette, you would type: *.ZIP. After giving the search file name or variable, press [Enter]. The WHEREIS.BAT file will list all the matches that it finds for the file name or global variable that you specified. Because WHEREIS.BAT uses the DOS ATTRIB command, you will not only have a listing that shows you the directory in which the file(s) exist but also the attribute of the file (which will be listed to the left of the path and file name).

Search Keywords

Hint Category

DOS/Windows 3.x

Date Created

24-03-97

Last Updated

23-03-99

Revision Date

23-03-2000

Brand

IBM Aptiva

Product Family

PS/1, Aptiva

Machine Type

2011, 2121, 2123, 2133, 2155, 2168, 2144

Model

C01; C34; M01; NEA; T35; U35; A62; A82; A94; B82; C42; C92; G42; M82; S92; 081; 087; 131; 137; K37; N31; N81; 11E; 13T; 14C; 16E; 17A; 18A; 18T; 19C; 21C; 23C; 28A; 46M; 51D; D50; G11; G13; G43; G46; G46; G49; G49; G50; G53; M40; M40; M46; M46; P11; P13; P43; P50; P53; R04; R05; R06; R09; R38; R42; R43; R44; R84; R86; R87; RO3; S11; S13; S43; S45; S45; S47; S47; S48; S48; S50; S53; W11; W13; W42; W42; W43; W45; W45; W50; W53; 20E; 22T; 24C; 24M; 28V; 39E; 41T; 43C; 45V; 48E; 50T; 52C; 55V; 72E; 74T; 76C; 78C; 79C; 81A; 82E; 84T; 86C; 87C; CC1; D53; G14; G44; G52; G54; G72; G76; G78; G82; NM1; P14; P44; P57; P71; P74; P76; P78; P84; R14; R15; R16; R17; R18; R51; R52; R57; R58; R62; R63; R67; R71; R89; R93; R96; R97; S14; S44; S50; S54; S70; S75; S76; S78; S80; W14; W44; W48; W54; W67; W76; W77; W78; Z33; 28V; 31E; 33T; 37C; 38C; 51E; 54T; 56C; 57C; 88V; BB1; G57; G87; OR1; OR3; OR4; OR5; P89; R28; R29; R31; R74; R78; R82; R98; S55; S85; SR1; US1; W52; W82; 1R2; 66P; 67P; 86P; OR8; 1R1; 1R3; 1R5; 22P; 24P; 25P; 27P; 29P; 63P; 67P; 82P; 83P; OR6; OR7; OR9; 1R0; 1R1; 26P; 62P; 2R0; P30; 2R3; S15

TypeModel

Retain Tip (if applicable)

Reverse Doclinks
and Admin Purposes