I have a batch file which is on a usb key. I need to know the drive name the batch is in.
Example, if it\'s E:\\mybatch.bat it should find E:\\ same thing for F:\\, G:\\
You can find all USB drive letters from any drive with this.
@echo off for /F "usebackq tokens=1,2,3,4 " %%i in (`wmic logicaldisk get caption^,description^,drivetype 2^>NUL`) do ( if %%l equ 2 ( echo %%i is a USB drive. ) )