troubleshooting Question

Find File Using a Batch File On 2 Different Drives. - If Not found on the first one to check the second one in the root directory.

Avatar of Vicki05
Vicki05Flag for United States of America asked on
Windows Batch* batc
14 Comments1 Solution79 ViewsLast Modified:
Search USB Drives. If file is not found on the first one to go to next.


Hi All,

I am trying to use a batch file that is run from local disk C: which looks for a specific file. If file not found on the first one to go to the second one.  It checks the first drive letter but it will not go to the next drive.


echo  Checking For USB
for %%a in (f g) do if exist %%a:\nul (
  set Drive=%%a
  echo  USB or Extended Drive Found
  goto Run
)
echo.
echo  File Not Found, Please USB Stick
pause
goto EndBad
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 14 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros