|
Here's our Tip for.. March 7, 2000
Click Here to see a complete list of all of our previously released Tips!
Locating a File Using The Command Prompt
If you're trying to check for the existence of a file in a Windows NT 4.0 environment using a batch file, instead of any other tool, then you might want to check this out.
Assuming that you want to see if the file is present on the hard disk, you can use a batch file like the one shown here to search for a file in a given folder. To generate the batch file, run Notepad and enter the following commands:
@echo off
if exist %myfile.xxx goto here
echo Not found
goto end
:here
echo Found it
:end
Now, choose File, Save As and name the file Look.cmd. Locate a folder for your new file, then click Save to save the file and close the Save As dialog box. To run the file, go to the Command Prompt window (click Start, Programs, Command Prompt), type
look
and press Enter. If the file you specified in Look.cmd is in the current folder, Look.cmd will display Found It. If the file is not in the current folder, Look.cmd will display Not Found. You can expand on this routine to locate other files in other folders.
|