Recover Deleted Files from Memory Card Using CMD

Jean updated on Oct 29, 2019 to Storage Media Recovery | How-to Articles


Memory card files are lost, how to recover files? Can you use CMD to recover deleted files, or how CMD works for undeleting files on a memory card? This page gives an elaborate answer to the questions. Do not hesitate to try EaseUS SD card recovery software as well, which is specialized for all kinds of data loss problems, including deletion, formatting, partition loss, RAW and other inaccessible issues.

Can You Recover SD Card Using CMD?

CMD, as known as Command Prompt/cmd.exe, is available in most Windows operating systems. By entering a specific command, users can self troubleshoot certain kinds of Windows issues. Knowing useful CMD commands will let you have more control over your Windows PC.

"What's the command to retrieve deleted files?" you may ask.

"I'm trying to find a free method to recover some deleted photos from a 64GB SanDisk SD card. I heard that using CMD might work, but where should I start?"

Indeed, for file recovery, you can take advantage of the attrib command. It's designed to display, set, or remove attributes assigned to files or directories. Microsoft gives a full explanation to the attrib command, along with some examples.

How Attrib Works

Many people are using an external storage device to preserve pictures, videos, or documents, and some are using SD cards for digital cameras/Android phones. In rare situations, the memory card files are not showing up, missing somewhere, or disappearing without a trace, whereas most of the time, data are deleted or corrupted.

Likewise, the way you lost files from the SD card determines the possibility of whether the attrib command can get the data back or not. So what exactly can the command help recover?

By changing the file attributes using the CMD method, you can only recover hidden files. Whenever you accidentally deleted files or photos from the SD card or got it formatted without a backup, there is no way to restore files using the existing command lines for Windows. Instead, seek help from exclusive data recovery software.

How to Recover Files from Memory Card Using CMD

If you lost files without an apparent reason, it's likely that they are hidden. Usually, the culprits can be a virus, malware, encryption software or other system manners, such as Windows system update, reinstallation, and so on. You're supposed to unhide all the missing files and folders by using the following command lines. They'll return all invisible items to the original location until you execute the entered commands.

Step 1. Use a card reader to connect the memory card where you deleted files to a Windows computer. Assuming that the drive letter of the card appears as drive G:.

Step 2. Press the Windows key + R simultaneously. In the search box, type cmd and press Enter. Now, cmd.exe is launched.

Step 3. Type the first command line: chkdsk G: /f and then press Enter. (Replace G with the exact drive letter of your memory card.). Type Y to allow the command to proceed if asked.

Click to copy

You might encounter an error message saying that you don't have sufficient privileges. It's because you don't have administrator permission. 

cmd without priviledges

Alternatively, press Windows + X keys and choose Command Prompt (Admin) to open the Command Prompt this time. Continue with the chkdsk command.

open command prompt as admin

Step 4. Type G: (the drive letter) again to go back to start again.

Step 5. Type [G:\>attrib -h -r -s /s /d *.*]. This attrib command will recover everything that you cannot see from the memory card.

Click to copy

Syntax explanation:

  • –h clears the Hidden file attribute.
  • –r clears the Read-only file attribute
  • –s clears the System file attribute.
  • /s applies attrib and any command-line options to matching files in the current directory and all of its subdirectories.
  • /d applies attrib and any command-line options to directories.

After clearing all the protected attributes of files, you could see one or more new folders appearing on the SD card again. 

Alternative Software to the Windows Command Prompt

Manual input of the command line is suitable for computer professionals since wrong commands can cause more severe problems. Therefore, for security and usability, we strongly recommend you try an automatic command line alternative. EaseUS Tools M is a practical tool that enables you to check and fix files system error, enable/disable write protection and system update with one-click instead of typing intricate command lines.

Follow the simple steps below to show hidden files with this 1-click-fix software. 

Step 1.  DOWNLOAD EaseUS Tools M for Free.

Step 2. Start EaseUS Tools M, choose "File Showing" on the left pane. Next, choose the target drive for scanning.

show hidden files - step 2

Step 3. After the operation completes, click the View button to check the hidden files. 

show hidden files - step 3

All-round SD Card Recovery Freeware for Deleted, Formatted and RAW Recovery

To achieve a high success rate of deleted file recovery from a memory card, USB flash drive or other data storage device, there is no other way but third-party SD card recovery software can handle it.

EaseUS Data Recovery Wizard can perfectly replace the role of the attrib command in retrieving hidden files. Moreover, it is specialized for all kinds of data loss problems, including deletion, formatting, partition loss, RAW and other inaccessible issues. As you test by yourself, the CMD method fits advanced users who have some computer skills, while EaseUS file recovery software applies to both average and experienced users due to an intuitive interface and plenty of auxiliary functions.

Step 1. Select the memory card and scan

Connect the memory card to your computer and launch EaseUS card recovery software on your PC. Click "Scan" to start looking for your lost data.

select a location and click scan

Step 2. Wait for the scanning process to finish.

After the scanning process, you can check and filter wanted files in this program. Click "Filter" if you are looking for a specific file type.

select the memeory card files

Step 3. Recover wanted files.

You can directly double-click the files to preview and see if the files are all right. After this, you can choose wanted files and click "Recover" to restore them to a secure location on your PC or other external storage devices.

recover memeory card files

100% of people found this article helpful.


Frequently Asked Questions

1. Why choose EaseUS Data Recovery Wizard?

"EaseUS Data Recovery Wizard is the best we've seen. It's far from perfect, partly because today's advanced disk technology makes data-recovery more difficult than it was with the simpler technology of the past, but it's fast and efficient..."PCMag

"The first thing you'll notice about EaseUS Data Recovery Wizard Pro is that its interface is very clear and uncluttered, with only a small collection of self-explanatory controls. You won't find lots of extra options hidden in a system of hidden menus, either; what you see really is what you get."techradar

"Recover lost files, even after deleting a partition or formatting your drive."Macworld

2. Why cannot I recover 2GB data for free?

It is recommended to check the version installed is Free or Trial because they are different versions.

Trial has data preview function but cannot save any files, while the Free version enables to recover 2 GB files. The default free space is 500 MB and you may share the product on social media to get another 1.5 GB.

3. Why cannot the recovered files be opened?

A file is saved as 2 parts on the storage device: directory info (which is comprised by file name, time stamp and size info, etc.) and data content.

If the files with original file names and folder structures cannot be opened, one possible reason is the corrupted directory info. There is still a chance to recover the data content with the RAW Recovery method in our software.

4. Why isn't it suggested to recover the files back to the original drive?

The storage structure of the lost files would be altered or damaged by any changes on the drive. If you save the recovered files back to the same drive, the original data structures and data content would be corrupted or overwritten, which causes permanent data loss. So you should prepare another disk to save the files.

5. How can I check whether my data is recoverable or not before purchase?

The Free version helps you save 2GB files to better verify the recovery quality of our product before purchase.

6. How long does it take to scan the drive?

It strongly depends on the capacity of your hard drive and the performance of your computer. As reference,most drive recoveries can be completed in around 10 to 12 hours for a 1-TB healthy hard drive in general conditions.

About Data Recovery Wizard

It's super easy to recover 250+ types of files after deletion, disk formatting and virus infection. Click the links and compare the difference of each version.