How do I remove a USB drive's write protection? [duplicate]

I have a SanDisk Cruser Blade USB stick that suddenly seems to be write protected. I tried running DiskPart but after I write the command "attributes disk clear readonly" it displays this:

Microsoft DiskPart version 5.1.3565

ADD         - Add a mirror to a simple volume.
ACTIVE      - Marks the current basic partition as an active boot partition.
ASSIGN      - Assign a drive letter or mount point to the selected volume.
BREAK       - Break a mirror set.
CLEAN       - Clear the configuration information, or all information, off the disk.
CONVERT     - Converts between different disk formats.
CREATE      - Create a volume or partition.
DELETE      - Delete an object.
DETAIL      - Provide details about an object.
EXIT        - Exit DiskPart
EXTEND      - Extend a volume.
HELP        - Prints a list of commands.
IMPORT      - Imports a disk group.
LIST        - Prints out a list of objects.
INACTIVE    - Marks the current basic partition as an inactive partition.
ONLINE      - Online a disk that is currently marked as offline.
REM         - Does nothing. Used to comment scripts.
REMOVE      - Remove a drive letter or mount point assignment.
REPAIR      - Repair a RAID-5 volume.
RESCAN      - Rescan the computer looking for disks and volumes.
RETAIN      - Place a retainer partition under a simple volume.
SELECT      - Move the focus to an object.

It's like when you type help at the DiskPart prompt, so how do I get past this? This problem started when I plugged the stick into a laptop which had viruses, if that's any help.


Solution 1:

First check if the USB stick has a physical write protect switch that might have been toggled by mistake.

Then at an elevated command prompt type diskpart, and at the DISKPART> prompt type the following:

list disk
select disk <disk number>
attributes disk clear readonly

If that doesn't help and the stick doesn't contain any important data, in Disk Management (Start / Run / diskmgmt.msc) right-click the disk, delete all volumes, then create a new simple FAT32/exFAT/NTFS volume and quick format it.