- 1 year ago
How to copy a file from a USB drive to C drive in Windows 10 using a batch file?
Comment
1 / 1
To copy a file from a USB drive to the C drive in Windows 10 using a batch file, you can use the xcopy
command. Here's an example batch file:
batch@echo off
set "usb_drive=E:" REM Replace "E:" with the drive letter of your USB drive
set "destination=C:\path\to\destination" REM Replace "C:\path\to\destination" with the desired destination folder on the C drive
set "filename=file.txt" REM Replace "file.txt" with the name of the file you want to copy
xcopy "%usb_drive%\%filename%" "%destination%"
echo File copied successfully.
In this example, you need to modify the following variables:
usb_drive
: Set it to the drive letter of your USB drive.destination
: Set it to the desired destination folder on the C drive where you want to copy the file.filename
: Set it to the name of the file you want to copy.
Save the above code as a batch file with a .bat
extension. Then, run the batch file, and it will copy the specified file from the USB drive to the specified destination folder on the C drive.
Make sure to replace the placeholder values with the actual paths and filenames that match your specific scenario.
Note: Ensure that you have appropriate read permissions on the USB drive and write permissions on the destination folder on the C drive to perform the copy operation.