Prevent copying of files to USB drive

There are times when you want to prevent others from copying your data but you still need them to be able to view it on your computer. The following tip will help you do exactly that.

As always it is the registry that comes to your rescue. Open the Registry Editor by typing regedit in RUN (WIN+R) dialog (more keyboard shortcuts). Go to th key


Protect files from being copied to USB device, registry key

Create a new DWORD named WriteProtect (Right Click on right pane and select New»DWORD). Edit the value and make it 1. Just restart Windows explorer and you are done. Next time somebody tries to copy data to the external storage device they will see

Can't copy to Mass storage device error
If you need to copy something just make the stored value of WriteProtect to 0

**Tips : to restart Windows Explorer take Shutdown. Click Cancel while holding down SHIFT+CTRL+ALT, this will close Windows Explorer. Now take TASK MANAGER by pressing ALT+CTRL+DEL take File>>New Task>> [ explorer ] and press Enter. **

41 thoughts on “Prevent copying of files to USB drive”

  1. I’ve tried the above trick but its value automatically change’s to zero…plzzz tell me something about it so i can fix it…

  2. Hi Good evening Ajith sir
    I Purchased a Video classes for my education purpose .. they sended video lectures in TAB :-
    1.Videos are meant for viewing only and cannot be downloaded or copy .
    2.Video will self expire as per the subject expiry.
    Tab Specification details are:
    USB Version USB 2.0
    Location Technology GPS,Glonass
    Earjack 3 .5mm Stereo
    Wi-Fi 802.11 b/g/n 2.4GHz
    Wi-Fi Direct Yes
    Bluetooth Version Bluetooth v4.0
    Connectivity PC Sync. Kies
    My question is how to RIP the data . bcz the data is going to expiry within few days . Please help me brother . waiting for your valuable reply .. thanking you very much

  3. Hi,

    I would like to know if we can allow only specific file types to be copied to USB. For example, allowing only .xml and .doc files to be copied to the USB. Also, please note that I am allowing only this registered USB to get installed on my system.


  4. Try using Non-Copyable USBs from
    You will get the best copy protection for your pendrives, SD cards, micro SD cards, TF cards, External Hard disks, etc at a very reasonable rates.
    See details here

  5. Hello,
    I have a requirement where users should able to copy data from pen drive to laptop/desktop, but could NOT be able to copy data from Laptop/desktop to USB drive.
    In addition this port should be open for all other devices, like cam, headphones, printers etc.
    Please let me know if it is possible. Users can have Win XP operating system

  6. plz help me

    In my office we are using USB mouse,and usb printer connection some people are using pen drives on that port, i need to stop to transfer data, but that port should work for usb mouse or printer connection, how to solve it on windows xp.

  7. Hi Does this method will also restrict files being burnt on a cd, or from one drive to the other? I just have one drive on my comp, thus unable to check.

    Also will this limit us from using a USB printer?

    U wrote it in 2008, it does work on xp7 have tried it, but have u recently found a better way of doing it. Can we have a password for this, rather than using “0”,s and “1” .. coz we need to use the usb quite some time..

  8. Hi,
    I want security like this…
    Owner is able to copy/paste/delete file from PC but when other user comes and try to to delete something OR copy data to USB OR copy data from USB to PC then it’s not permitted to do so.

    Anyone have idea?


  9. This will prevent people from copying files from HDD to USB. But i want that users is not able to do copying files from USB to HDD. Can You Help me for this ……..

  10. Hi Iqbal,
    Thanks a lot for visiting my blog man. I have tried the above mentioned trick on Vista and seems to work. So it would probably work with Windows7. Also there is an application named “Prevent” that can be used to prevent copying to USB drives. It works with Win7. I haven’t used the application. I will test the trick on Win7 in a couple of days and leave you a reply.

  11. Hi Ajith, think your amazing mate! My problem is that I want to try this in Windows 7, will the instructions you gave still be the same? Thank you.

  12. Hi,

    i would like to know if this works in vista, because I tried it and I don’t know if I did something wrong or if It doesn’t work in vista.
    Thank you for your time

  13. Hi Roger,
    The files from USB can be copied to the HDD. The second thing can’t exactly be done using the default XP utilities. yOu might need some other software to do so. Because you can lock reading a file. And copying is similar to reading.

  14. Hi Ajith,

    This will prevent people from copying files from HDD to USB. But can files from USB be copied to HDD?

    And is there anyway that you know of that prevents people from copying a certain files only (only allows them to view from the pc).

  15. Hi Jo2xflash,

    thanks for coming to my blog. Please subscribe to the full RSS feed [] so that you can read the future posts right at your desktop.

  16. thanks you helped me alot. god bless you
    i have solved my problem with my roommate that keeps copying my privatefile from my machine

  17. Hi.. I have Windows XP but when I open the Registry Editor cannot find the StorageDevicePolicies folder; although the others (e.g. system resources) are shown. Any comments on how to avoid someone to copy my files to a DVD and/or USB? ..

  18. any lock on vista (no pun intended); should work tho’ since vista is just an XP SP4 – my hdd is basically a server for all the lazy guys who come to rip me off my hard day’s job downloading all kinds of stuff.

  19. Hi Rajat.. 😉 Can you send me some screen shots of errors shown when you try to sopy something from USB. Send them to ajithonly at

  20. ajith,you are supercool mate.My problem is that somebody has restricted copying of files from my dvd drive and from usb drives.please help me .

  21. Hi Anand..
    Good news and bad news..

    I found a way.. but I couldn’t try it on any Win 2000 system..

    The method is through management of removable devices.. I will post about it tomorrow..

  22. Hi Ajith,

    Thanks for the quick reply, i will await your response with respect to win2k tweaking.

    Regards, Anand

  23. You helped me a lot through this code, Could you please tell me the thing that how can i prevent copy even from the USB.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>