Introduction: Copy an USB Drive With a Shortcut Key

About: Electronics Hobbyist

This is a simple DOS batch program which allows u to copy all data of any USB drive to ur hard drive, when a drive is connected to ur PC.

Make sure u have administrator privileges.

Step 1: CODE WRITING

Copy paste the below code to ur notepad

@echo off
if exist c:\pendrvcped\ goto :cop
md c:\pendrvcped
:cop
echo *****Antivirus scanning your drive for Viruses*******
echo *****DO NOT INTERRUPT IN THE MIDDLE********
xcopy /a /e /k /q /h <ur drive to be copied eg.E>: c:\pendrvcped
cls
echo *******Virus scan completed sucessfully****
echo.
echo ******NO VIRUSES FOUND********
pause


Just type the one word drive letter in the angle bracket Eg. E: 

Save the notepad file as drvcpy.bat in desktop

Step 2: Shortcut Assigning

Create a shortcut on the desktop for drvcpy.bat

Now right click shortcut goto properties and choose ur shortcut key. Check pic



Step 3: Sample

You are ready to go now

Check out the Sample

After u press the shortcut key the cursor blinks which means the files are being copied.
The time u can tell others that u are scanning the drive for viruses.

Step 4: MODIFIED CODE

If u r copying more than one drive, u can create a separate random named folder with date and time of that copy with the below code

@echo off
if exist c:\pendrvcped\ goto :cop
md c:\pendrvcped
:cop
set nary=%random%
set kd=%date%
set kt=%time%
md c:\pendrvcped\%nary%
echo %kd% >> c:\pendrvcped\%nary%\$$$$KDT$$$$.txt
echo %kt% >> c:\pendrvcped\%nary%\$$$$KDT$$$$.txt
echo *****Antivirus scanning your drive for Viruses*******
echo *****DO NOT INTERRUPT IN THE MIDDLE********
xcopy /a /e /k /q /h f: c:\pendrvcped\%nary%
cls
echo *******Virus scan completed sucessfully****
echo.
echo ******NO VIRUSES FOUND********
pause


u can see the date and time in the file $$$$KDT$$$$.txt under the random named folder post copying.

Step 5: Automation and More

More....................

1. U can also automate this complete code soon after an USB drive is connected w/o any shortcut key
2. Drive chooser
3. Hidden pendrvcped folder + more attributes
4. Totally running in hidden mode
5. Use the program even u r as guest.

mail me at kua201@gmail.com