windowsbatch-fileusbrenameusb-flash-drive

Is it possible to rename a USB flash drive and transfer files onto that drive?


I am using a batch (below) found elsewhere to facilitate moving the files onto the USB flash drives, but want to also rename the flash drive in the process. How would I incorporate the renaming in Win10?

@echo off
cls
:start
set choice=
xcopy /e /y C:\Users\asimpson\Desktop\transfer\*.* E:
goto wait

:check
timeout /t 1 /nobreak >nul
echo waiting
if exist E: (goto start) else goto check

:wait
timeout /t 1 /nobreak >nul
echo Waiting for removal
if exist E: (goto wait) else goto removed

:removed
echo removed
goto check

Solution

  • The label command can be used in batch files to set the the volume label of a disk.