Recover Deleted Files from Memory Card Using CMD

This page tells you the detailed steps of how to recover deleted files from memory card using CMD. What's more, do not hesitate to try EaseUS SD card recovery software, which is specialized for all kinds of data loss problems, including deletion, formatting, partition loss, RAW, and other inaccessible issues. Keep reading and learn more about it.

Table of Contents

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 Windows issues. Knowing useful CMD commands will let you have more control over your Windows PC.

"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?" One user asked this question in a forum wondering how to recover the SD card using CMD. If you have the same question, in this article you will get the answer.

What is the Attrib Command?

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. The way you lost files from the SD card determines the possibility of whether the attrib command can get the data back or not. The attrib command is 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.

Let's make it simple. The attrib command is usually used to recover files hidden in SD cards/memory cards that have been attacked by viruses. If you have accidentally deleted files or photos from the SD card or got it formatted without a backup, there is no way to recover files from the SD card using CMD for Windows. Whenever you Instead, seek help from exclusive data recovery software.

Method 1.Recover Deleted Files from Memory Card Using Recovery Software

To achieve a high success rate of deleted file recovery from a formatted SD card, third-party SD card recovery software is recommended for you to try. EaseUS Data Recovery Wizard can perfectly replace the role of the attrib command in retrieving hidden files.

Unlike the CMD command which requests computer skills, EaseUS file recovery software is designed for all levels of users with an intuitive interface and plenty of auxiliary functions.

Video Tutorial of Recovering Deleted Files from Memory SD Card

It specializes in recovering data from all kinds of data loss problems, including deletion, formatting, partition loss, RAW, and other inaccessible issues.

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

Method 2. How to Recover Hidden Files from Memory Card Using CMD

If you lost the memory card 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.

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.

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.

Method 3. Recover Hidden Files using CMD Alternative

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

Was This Page Helpful?

author icon

Updated by Gemma

Gemma is member of EaseUS team and has been committed to creating valuable content in fields about file recovery, partition management, and data backup etc for many years. She loves to help users solve various types of computer related issues.

Read full bio

author icon

Written by Jean

Author Jean has been writing tech articles since she was graduated from university. She has been part of the EaseUS team for over 5 years. Her special focuses are data recovery, disk partitioning, data space optimization, data backup and Mac OS. By the way, she's an aviation fan!

Read full bio

Product Reviews

TrustScore 4.7 | 323 reviews
  • EaseUS Data Recovery Wizard is a powerful system recovery software, designed to enable you to recover files you’ve deleted accidentally, potentially lost to malware or an entire hard drive partition.

    Read More
  • EaseUS Data Recovery Wizard is the best we have 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.

    Read More
  • EaseUS Data Recovery Wizard Pro has a reputation as one of the best data recovery software programs on the market. It comes with a selection of advanced features, including partition recovery, formatted drive restoration, and corrupted file repair.

    Read More