Copy a file into USB flash drive root using batch files
问题 I want to create a batch file to copy a file from any Dir into root folder that the .bat file located on that like a USB flash drive . My incomplete command : xcopy /s "%userprofile%\Desktop\test.txt" "?" What can I replace with "?" ??? Thanks guys 回答1: This will do exactly as you want to any and all connected USB drives. @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 ( xcopy /s "%userprofile%\Desktop\test