How to Format Write-Protected SD Card Using CMD?

This post will show you how to format write-protected SD card using CMD. If you encounter the problem like “The disk is write-protected” when formatting, you should read this article.


By Cherry / Updated on May 12, 2023

Share this: instagram reddit

SD card won’t format write protected

Have you ever encounter the problem that SD card won’t format write protected? Here are several reasons that may cause this error.

1. Your SD card is under a physical write protection.

2. Your SD card is locked down due to digital write protection.

3. Your SD card contain bad sector and got corrupted.

4. Your SD card might got infected with virus.

The truth is you cannot format a write protected SD card unless you removed the write protection from the SD card.

How to remove write protection from SD card?

For different situations, you need to use different ways to remove write protection from SD card.

Solution 1. Removing physical write protection

Virtually all SD cards have a physical lock that can be toggled to enable or disable write protection. For this situation, you need to find the lock switch for the SD card, and slide the lock switch to turn off the SD card’s write protection and enables you to format the SD card, or store, delete files and data on the card.

Solution 2. Removing digital write protection on Windows

If your SD card is locked down due to digital write protection, you can take the following method to remove it.

1. Connect your SD card to your Windows computer. If your PC does not have a card reader, you’ll need a USB SD card adapter for connection.

2. Press Windows + R key simultaneously, type cmd and press Enter to run it as administrator.

3. Type diskpart, then, press Enter.

4. Type list disk and press Enter.

5. Type select disk disk number>, the number is replaced by the SD card’s number., then press Enter.

6. Type attributes disk clear readonly, and press Enter.

It will take a minute to remove write protected from the SD card. After while, you should see a line of text that reads “Disk attributes cleared successfully” appear in the window. As so far, your SD card is no longer write-protected.

Solution 3. Checking and fixing errors on SD card

Bad sector is one of the reasons that cause SD card won’t format write protected. Thus, you need to check and fix bad sector on the SD card.

1. Double-click This PC to open Windows File Explorer.

2. Right-click the SD card and select Properties.

3. Under Tools tab, click Check to check and fix errors on the SD card.

You can also run CHKDSK.exe to fix corrupted SD card using CMD.

Solution 4. Using anti-virus software

If your SD card is got infected by virus, you need an anti-virus software to remove the virus. After that, you can reuse the SD card in normal.

After removing write protection from SD card, you can format write protected SD card using CMD.

How to format write protected SD card using CMD after removing write protection?


This procedure will erase all data on the SD card, if you do not want to lose any data, you need to save data before formatting SD card.

To format SD card after removing write protection, you can do as following steps:

Press Windows + R key simultaneously, type cmd and press Enter to open command prompt.

In the command prompt, type diskpart and press Enter.

Type list disk, and press Enter.

Type select disk n, n refers the number of your SD card, press Enter.

Type clean, and press Enter. It will erase all data from the SD card.

Type create partition primary, and press Enter.

Type select partition 1, and press Enter.

Type active, and press Enter to make the partition active.

Type format fs=ntfs (or format fs=fat32) and press Enter to format the partition to a desired file system.

That’s all about how to format write protected SD card using CMD. If you do not familiar with CMD, you can try an SD card format tool to make things easier.

Format SD card with SD card format tool

AOMEI Partition Assistant Standard should be a great FREE SD card format tool that can format SD card in a few simple mouse-clicks. It also can avoid some formatting problems, for example, diskpart has encountered an error access is denied, etc. It allows you to format partition to NTFS, FAT32, exFAT, Ext2/3/4. You can even format a partition which is larger than 32GB to FAT32. Here are the steps of how to format SD card with AOMEI Partition Assistant.

Free download AOMEI Partition Assistant. Windows 11/10/8.1/8/7/Vista/XP is supported. If you are Windows Server users, please turn to AOMEI Partition Assistant Server Edition.

Step 1. Connect SD card to your Windows PC. Install and launch AOMEI Partition Assistant. To format SD card, here you need to right-click it, then select Format Partition in the pop-up menu.

Format Partitoin

Step 2. Here you can edit partition label, choose file system and change cluster size for your SD card. Here we choose to format this 128GB SD card to FAT32. Click OK.


Step 3. Click Apply to submit the pending operations.



In a word, if you want to format write protected SD card using CMD or other ways, you have to remove write protected from SD card first. AOMEI Partition Assistant is a simple write protected SD card format software, but you may still fail if you did not remove write protection from SD card in advanced. Hope this article can be helpful for your situation.

Cherry · Staff Editor
Cherry is an editor of AOMEI Technology, she covers backup & restore, hard disk & partitions management, cloud files transfer, website & database backup and so on for AOMEI. She enjoys helping people find solutions to their problems. She loves traveling, cooking, reading and so on. She takes most of time with her family when she is not working.