1.

Solve : Finding flash drive letter?

Answer»

Hello,

I sure this is real easy for you all but, its driving me nuts . How do I find a USB flash drives DRIVE letter (ex L: or F:) using cmd?

Thx,
Boot StrapsDepends on the context and even then the RESULT can be inconclusive. For example, this snippet may work:

Code: [Select]@ECHO off
for /f "tokens=3" %%i in ('echo list volume ^| diskpart ^| find /i "Removeable"') do (
echo %%i:
)

However, if there are two removable drives on the system which one is correct? You could use the above snippet to search for the volume label, but you would need to know the volume label to write the script!

If you use autorun on the drive, you might be able to derive the drive letter from the %0 variable of the opened file.

What are you trying to do?



Discussion

No Comment Found