1

How would I go about making a program that scans for a certain file inside a certain directory, not on the C:\ drive?

I know that IF EXIST does find a certain file, but I want it to to only try to find a certain file inside a certain directory, not on the C:\ as a whole.

1 Answer 1

1

Add the full path and filename to the IF EXIST and it will only check in that specified folder.

IF EXIST "C:\folder\folder2\file.ext" ...

Edited by Magoo - added quotes which are required if the full path contains spaces or some other characters

Sign up to request clarification or add additional context in comments.

2 Comments

So, for example, I was looking for hi.txt in C:Windows, I would go IF EXIST "C:Windows" hi.txt, or IF EXIST hi.txt "C:Windows"?
The whole path and file name need to be in quotes if there are any spaces: IF EXIST "C:Windows\hi.txt"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.