How To Recover Deleted Photos/Videos From SD Card Using Cmd


This guide tells methods to undelete data from sd card using cmd no matter how your images or videos were lost(accidental deletion, formatted by mistake, sd card inaccessible, sd card format error, sd card needs to be formatted, sd card no file system, sd card shows no file, sd card infected with virus...). When users are looking for methods to retrieve images videos from sd card using command prompt, this article introduces a sum of ways to recover sd card with cmd. And if cmd is not working for your sd card, you may use free tools too. (Frankly cmd often does not work for an sd card recovery while free tools usually have better results than cmd).

Content Navi

How can I recover permanently deleted photos from sd card using cmd

How do I retrieve deleted images from sd card? If the images or videos were just deleted by mistake and you wish to restore them using command prompt, this article will share some ways to use cmd for sd card recovery.

The truth: If the delete images were lost/formatted and new images/videos were saved on the same sd card, chance of recovery will decrease. However it does not mean the deleted files have no chance of recovery. It just represents that some images could be damaged.


Here are are some tips you need to keep in mind for better sd card recovery.

  • Avoid new data storage: Power off your phone/camera and pull out the sd card from device. Never use your sd card on camera or phone for new data storage before the files were totally restored to keep the best chance of recovery.
  • Label the sd card: You may give a special mark on your sd card to get it better managed on computer and most important, it will easily keep itself from wrong formatting.
  • Backup the rest data soon if it's just a few images lost from the previous accidental deletion. You may backup the images, videos that still can be read on sd card to a hard drive volume or to an external usb disk etc.

Items for sd card recovery

Here are some items you need to prepare for a DIY sd card recovery using cmd.

  • A computer with Windows OS. Usually a computer that has Windows installed is preferred since the cmd is offered by Windows Operating System, if you want to use the cmd, you need to use a Windows computer.
  • A memory card reader: A memory card reader/adaptor is required for sd card recovery since when the sd card is inserted with a card reader, it will show up as a drive in computer for operations with cmd
  • Internet connection(Not 100% essential): If you are not a tech pro or it's the first time you use cmd, here are some videos on this page that shows how to use the cmd for better instruction and internet connection shall be request if you want to watch the videos. Don't worry if there were no internet connection. You may open this page from a phone, watch the video guide from phone and follow the instructions on your pc

5 CMDs for SD Card Recovery

Before all the recovery, here is the guide to open cmd on Windows computers.

How to open cmd?

  • Way 1 -> Open the cmd from "Search&Find" and type 'CMD' and press enteropen cmd
  • Way 2 -> Open cmd from Run and type 'cmd' in the blank column and then press enter on key board or click the OK in the RUN cmd

And then a cmd window will show up like cmd

Video - how to open cmd in Windows 10

Once your cmd is started, you may use the following command prompt for a recovery.

#1 Recover (The most efficient cmd if the photos or videos were deleted or even permanently deleted from sd card before overwritten under the condition that you could remember the deleted file names)

Note: Please insert sd card to pc with a card reader at first, and then open your computer THIS PC to see which drive letter your sd card has in your pc. For example, here we see a drive letter f for sd card as an example for the following sd card recovery using cmd.

  1. Step 1 - Type 'f:' (If your sd card shows as drive G, you need to type 'g:' in this step)
  2. Step 2 - Type 'recover + file name plus file type', for example 'recover 437615.jpg' is to recover the image 437615.jpg which means you need to have the file name and its file format as a recovery condition. (No file name or file format? It's just what happened to most users who do not have the file names. So you may try the second cmd to see any luck.)

unformat sd card using cmd recovercmd to recover deleted images from memory card on Windows pc


#2 Undelete

Steps to retrieve deleted photos videos from sd card using command prompt undelete.

  1. Step 1: Insert sd card to pc with a memory card reader, and remember what drive letter it is on your pc, here we suggest it be drive F as an example for the following command steps
  2. Step 2: Open cmd
  3. Step 3: Type 'F:' and press enter key on your keyboard
  4. Step 4: Type 'undelete \folder name\ *.* /all' (You need to replace folder name with your own folder name such as 889 if the folder name is 889, if there is no folder name on the sd card, you may directly use "undelete /dt")

To undelete all recoverable files in the LETTERS directory, enter

undelete \letters\*.* /all

To undelete all recoverable files in the current directory using the delete-tracking file, enter

undelete /dt


#3 Attrib

This cmd would help show all files that were hidden on sd card if the images or videos do not show up in the memory card. Here are the steps.

cmd pen drive recovery

Video guide - how to recover sd card with attrib

#4 Chkdsk

Chkdsk is to repair damaged sd card especially when the sd card has no file system information or the sd card has logical errors. You may use this cmd for sd card recovery with the following steps.

  1. Step 1: Insert sd card to pc and remember its drive letter, such as drive h
  2. Step 2: Open cmd
  3. Step 3: Type 'h:' and press enter
  4. Step 4: Type 'chkdsk /f'

Or you may directly use cmd 'chkdsk h: /f' to repair the damaged sd cardcmd pen drive recovery

Video - how to repair sd card using chkdsk

Further reading: repair damaged sd card using cmd

#5 Diskpart

Diskpart is an efficient way to fix damaged sd card by simply get it formatted using diskpart. diskpart to repair sd card

What could Diskpart.exe do for a memory card?

  • Repair logical damages/errors on sd card by formatting
  • Change the drive letter for sd card, or assign a new drive letter for sd card when it is not showing up in pc
  • Initialize an sd card
  • Remove sd card write protection...

These above functions using diskpart.exe are not detailed here.

Part 2 - Third party free sd card recovery tool

This following sd card recovery utility is 100% free for recovering sd card data with easy to read UI and deep in search scanning algorithm which is worth of a trial.

iCare Data Recovery Free works on Windows computers for free sd card recovery when your sd card is not working, sd card images deleted by mistake, sd card not functioning... It is free of charge for all users.

recover files

  1. Platforms: Windows 11/10/8/7/Vista/XP
  2. Price: Free
  3. Supported SD card: all types memory card not limited to sd card

Read More


SD card recovery using cmd undelete, chkdsk, attrib, recover, and diskpart is not for computing starters and sometimes it may do not work for your sd card with just one advantage - free of charge. However free tool iCare Data Recovery Free may do the recovery job for sd card espeically when you need to recover photos from sd card, or not just images but video is included too.


Related Articles