Need to edge out the competition for your dream job? Train for certifications today.
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
FOR %%A IN (C D E F G H I J) DO IF EXIST %%A:\bquest Echo Exists in %%A
Open in new window
FOR %%A IN (C D E F G) DO IF not EXIST %%A:\bquest Echo not Exists in %%A
goto notexist <--no mater what it goes to this line
) else (
Be seen. Boost your question’s priority for more expert views and faster solutions
FOR %%A IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (
FOR /D /r %%G in (bquest) DO (
Echo *** %%G is exist **
echo not exist
for %%A in (C D E) do (
echo Searching drive [%%A]
call :LookForDir "%%A:\"
if "!Found!" == "Y" goto :FoundIt
echo Directory not found
echo Directory found
for /D /R "%~1" %%B in (bquest.*) do (
echo Found file [%%B]
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
for %%a in (c d e) do dir %%a:\ /ad /b /s | findstr "\<bquest\>" >nul && goto exists || goto notexist
for %%a in (c d e) do dir %%a:\ /ad /b /s | findstr /b /e "bquest" >nul && goto exists || goto notexist
pushd g:\ 2>nul
if errorlevel 1 (
md "%temp%\%~nx0.tmp" 2>nul
subst g: "%temp%\%~nx0.tmp"
md bquest "x bquest x" x(bquest)x x-bquest-x x.bquest.x x_bquest_x
dir /b /ad g:\*bquest*
dir /b /ad g:\ | findstr /b /e "bquest"
@subst g: /d 2>nul
@rd "%temp%\%~nx0.tmp" /q /s 2>nul
(dir /a-d /b /s c:\ d:\ e:\) | findstr /e /c:"\bquest" && goto exists || goto notexist
(dir /a-d /b /s c:\ d:\ e:\) | findstr /e /c:"\bquest" >nul && goto exists || goto notexist
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment