Condition:
I have 3 different folders. Folder1
, Folder2
and Folder 3
.
They are placed within an unknown USB drive.
Also the path is random.
Sometimes it's:
G:\Hello\Folder1
G:\Hello\Folder2
G:\hello\Folder3
and sometimes it's:
k:\Man\Google\Hey\Folder1
k:\Man\Google\Hey\Folder2
k:\Man\Google\Hey\Folder3
Means they are exist in random driver letters and also want to find with any random subfolder.
I used:
@echo off
for %%a in (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 (
if exist %%a:\HOPE\EXTRA\Folder1 (
goto true
)
)
Here I don't want use (C D E F G H I J K L M N O P Q R S T U V W X Y Z)
because cmd
shows an error when driver letter is found but voume not mounted.
So I used following script
@echo off
CLS&ECHO.&ECHO Vol Access Type
echo.
SET "DVF="
FOR /F "tokens=1,*" %%A IN ('wmic logicaldisk get caption^, description ^| FIND ":"') DO (
VOL %%A >nul 2>&1 && (
CALL SET "DVF=%%DVF%% %%A"& ECHO %%A ^| ON. %%B) || (
ECHO %%A ^| OFF. %%B
)
)
ECHO.
ECHO.
ECHO Available Volumes: %DVF%
echo.
echo.
TIMEOUT /T 5
I want to find Folder1
, Folder2
and folder 3
from available volumes, but here output of %DVF%
is C: D: K: G:
So I want to search each available volumes to find those 3 folders are available in 1 volume and then set
that drive = %foldervol%
, or something, for next code or goto next
So can anyone help me using same script I mentioned here?
I want to find all three folders from unknown available volumes then echo folders found at volumename and goto next?