I\'m trying to write a batch file to xcopy a folder to a removable USB drive. The problem that I face, however, is that drive letters are subject to change, so I would like
This works in Windows XP:
for /f %%D in ('wmic LogicalDisk get Caption^, VolumeName ^| find "DRIVE_LABEL"') do set DRIVE=%%D
(Use %D instead of %%D if run directly from command line.)
%D
%%D