How to Recover Deleted Files with Command Prompt (2024)

Amy Dennis

Jul 17, 2024 • Filed to: Recover Files • Proven solutions

"I've got important data that I need to recover from my computer HDD. Is there any simple way to recover files using cmd?"

  • Part 1: How Do you Use CMD to Recover Lost or Deleted Data
  • Part 2: How to Recover Deleted Files if the CMD Method Fails
  • Part 3: Why is it Possible to Recover Deleted Files With Command Prompt?
  • Part 4: How to Prevent Permanent Data Loss

Windows Command-Line provides a reliable way to recover files from nearly all storage media, memory card, flash disk drive, HDD, SSD, pen drive and any other storage media without the use of software on your machine.

The next question that brings everything into perspective is:

How do you recover files with the command prompt? And can you use the command prompt to recover all lost data? Folks are asking the same question for command prompt data recovery.

To answer that correctly, we'll check if there is any command-line available to execute the recovery.

Command prompt is one of the powerful and applicable Windows built-in utility that enables you to take full control of your computer and could get the work of data recovery done after any data loss-accidental deletion, virus attack, unintended storage formatting, and many more data loss scenarios.

Part 1: How Do you Use CMD to Recover Lost or Deleted Data

2.1 Recover Files from External Drive Using CMD

To recover files using cmd from external drive, we'll use the attrib command.

This command applies to Deleted, lost, hidden, and even virus-infected file recovery.

It supports devices like Windows drive, external HDD, USB, SD card, and any other external storage media.

Note:Remain careful when you follow the command line. A tiny wrong typing error can result in serious problems.

A Step-by-Step Guide Recover Files from an External Drive using CMD

  1. Plug in your external storage media to your system.
  2. Head over to the start menu, and key in "cmd" in the search bar, and hit the Enter key. This will open a pane on the left, showing the command prompt app.
  3. Right-click on the Command Prompt app and select "open as admin" to open the windows of cmd.
  4. On the CMD command line, key in the following command:
    attrib -h -r -s /s /d drive letter:\*.*"

For instance, attrib -h -r -s /s /d H:\*.*" if the drive you wish to recover is H. Replace H with the external drive letter of your external storage media.

Method 2:

  1. Press Windows +R keys simultaneously, and key-in cmd in the search box.
  2. In the command line, key in chkdsk G/f where G is the disk letter you desire to recover.
  3. Press Y until the command line starts again.
  4. Again, enter the drive letter, for this case, G and hit the Enter key. The command line will go back to start.
  5. Enter the following command:
    [G : \ >attrib –h –r –s /s /d *.*] (Replace G with your disk letter)

The command will retrieve all files in the drive.

Here:

  • -r stands for the Read-only attribute, which means files are readable but non-modifiable.
  • -s assigns "System" attribute of the selected multiple files.
  • -h means hidden attributes for only selected files.
  • /s indicates to search a particular path including subfolders.
  • /d involves the process folder.

After completion of the recovery process, you can create a new folder on the external drive with all recovered files.

The files might come in .chk format. Change the file extension and choose a preferred extension for each file.

2.2 Restore Files from the Recycle Bin Using CMD

This is applicable in recovering deleted files and Recycle Bin File recovery.

If you delete files from the recycle bin, you can either choose to Right-click files in the recycle bin or follow the command lines to restore them to their original location before emptying it.

  1. Head over to the Start menu and key-in cmd the search bar. Then hit Enter. This opens a window on the left of your screen.
  2. Click on the Command Prompt app from the listing of the programs to access its command line.
  3. Key in Start shell: recycle bin folder on the command line and hit the enter button.
  4. Select the files you wish to recover.

Part 2: How to Recover Deleted Files if the CMD Method Fails

Command Prompt ability to recover lost data is limited to a large extent, which means that you may not be able to recover all files using the CMD entirely.

When the CMD command line fails to restore your data, a data recovery tool can be the best alternative.

The only problem?

It is a world of data recovery software. Choosing the correct one can be difficult. So we scrape every corner of the web, executing the hard work for you--including assessing the feature that makes it outcompete its competitors in the data recovery world, to bring you one of the world's best data recovery tools--Recover It--right in front of you. Here is what the tool has to offer to you.

How to Recover Deleted Files with Command Prompt (2)

Recoverit Data Recovery - The Best File Recovery Software

  • Smart Scan Technology: Employ exclusive smart scan technology that rapidly locates and restore files, even those that other recovery software could never find.
  • Deep Scan Technology: This mode utilizes RAW searching technology with mask capabilities and extended file search, that gets verbose information of a file.
  • Stronger Preview Function: Utilize the powerful, exceedingly optimized preview function that is even better than before.

Free Download | WinFree Download | Mac

User Guide: How to Use Recoverit Data Recovery Software

Step 1: Pick a recovery location

Select a target location to execute data recovery and recover files using the command prompt. Next, hit the 'Start' button.

How to Recover Deleted Files with Command Prompt (3)

Step 2: Scan the location you've selected.

Hitting the Start button initiates the scanning process, which takes some time depending on file size.

How to Recover Deleted Files with Command Prompt (4)

Step 3: Preview and Recover

After the scan, hit the Preview button to confirm the file you wish to recover. Then hit the Recover button to get all your lost data back.

How to Recover Deleted Files with Command Prompt (5)

Video tutorial on How to Recover Permanently Deleted Files from PC

Free Download | Win Free Download | Mac

How to Recover Deleted Files with Command Prompt (7)Security Verified. 3,591,664 people have downloaded it.

Part 3: Why is it Possible to Recover Deleted Files With Command Prompt?

With Command Prompt, you can troubleshoot many problems related to Windows, including hard drive recovery. It is the most powerful Windows-in-built utility which helps users to retrieve lost data.

Besides, this utility from Windows can help you build bad sectors on storage media and convert the RAW file system to NTFS. That's why if you accidentally lose your data you can directly use cmd to regain it.

But before we move ahead, let's dig a little deeper into the file structure to understand how cmd retrieves data.

A file consists of two parts:

  1. A directory, which includes the file name and the list of blocks
  2. The actual block which contains the data.

When you delete a file, your system only removes the directory of the actual blocks, and if not overwritten or modified, the block still contains the data.

Therefore, the directory entries are marked available and are hidden from the operating system.

In such cases, you can quickly recover your lost data using the command prompt.

Part 4: How to Prevent Permanent Data Loss

Nobody dreams of undergoing the data recovery process. Everyone would do what it takes to keep data safe.

And that's what we're going to focus on. And some of the following measures may be helpful.

  • Data Backup

In the data world, there is nothing that can replace backup to prevent data loss and avoid money-intensive recovery. Backup means that you're keeping at least a copy of the original file, preferably not in the same disk media. And that isn't all, verify your backup frequently. It is a bad surprise to wait until disaster strikes only to find that your backup is corrupted.

  • Practice Good Working Habits

While working with your computer, you must adopt healthy practices that can prevent major data loss scenarios, and in the worst-case scenario, will increase the chances of successful recovery.

  • Get a working Antivirus and Keep it Up-to-date.

Some malicious-ware and viruses can infect, delete, or modify your data secretly causing a computer crash and data loss at the same time.

To remedy this, you need a working antivirus and keep it up-to-date. Antivirus software is designed to protect systems from malware and other viruses that threaten your data. Viruses spread through the internet.

  • Maintain Software Updates

Software updates usually exist to patch invisible vulnerability—a vulnerability that can be a threat to your data. For safety purposes, keep your software up-to-date and shun the tendency of postponing updates and regularly check for pending software updates.

  • Protect your Hardware

Get serious in protecting your hardware by keeping all network components in secure, air-conditioned with low foot traffic to prevent accidents.

What's more, keep and access your system in a place that deters theft, such as video security and 2FA-enabled entry.

  • Use Data Protection Software

Make use of data protection tools that can keep sensitive information out of the wrong hands. These include cloud disaster recovery solutions, firewalls, virtual private networks, antivirus software, and even more, which will go along protecting sensitive data from landing into the wrong hands.

Conclusion

Nothing is more painful than the instant it hits you that your valuable data has to get out of hand and has entered the world of data loss. In a spur of a moment, data that means all to you can disappear suddenly substituted by an excruciating feeling of dismay. But Windows understand such a situation happens. And they present a free method to recover deleted files using the cmd.

However, cmd data recovery has plenty of limitations that a data recovery software can easily overcome. And Recoverit presents free data recovery for the first 100 MB without compromising anything—free recovery quality, and the process is similar to the pro version.

Free Download | WinFree Download | Mac

People Also Ask

  • Can I recover permanently deleted files using CMD?

    Unfortunately, CMD alone cannot recover permanently deleted files. Once a file is permanently deleted, it is difficult to retrieve it using CMD or any other method.

  • How effective is CMD in recovering recently deleted files?

    CMD can be effective in recovering recently deleted files as long as the disk or partition has not been extensively used since the deletion. The chances of successful recovery depend on how much data has been overwritten.

  • What if the "chkdsk" command doesn't recover my deleted files?

    If the "chkdsk" command doesn't recover your deleted files, it means they might have been overwritten or the file system is corrupted beyond repair. In such cases, you may need to use specialized data recovery software.

  • Can I use CMD to recover files from a formatted drive?

    No, CMD cannot recover files from a formatted drive. Formatting erases the file system structure, making it nearly impossible to recover files using CMD alone. You will need to rely on professional data recovery tools in such situations.

  • Is there a risk of data loss when using CMD for file recovery?

    Yes, there is a risk of data loss when using CMD for file recovery. If you continue using the disk or partition after the files are deleted, new data may overwrite the deleted files, reducing the chances of successful recovery. It's important to immediately stop using the disk or partition to maximize the chances of recovery.

Free Recover Data

Top Recovery Freeware
  • Recover SD card | 5 BEST.
  • 10 FREE for memory card.
  • Review Recuva Free.
  • Lost photos? Get the 5 FREE.
  • Review Easy Recovery Free.
Top Recovery Solutions
  • Recover various data for free.
  • Restore all Windows 10 data.
  • Recover various deleted files.
  • Recover deleted files free.
How to Recover Deleted Files with Command Prompt (2024)

FAQs

How to Recover Deleted Files with Command Prompt? ›

In the command prompt window, type SFC /scannow and press Enter . The system file checker utility checks the integrity of Windows system files and repairs them if required. After the process is complete, reboot the computer.

How to recover permanently deleted files? ›

How do you retrieve permanently deleted files?
  1. Check the Recycle Bin on your computer and see if the file is there.
  2. Open up or install Windows File Recovery to restore your old files.
  3. Use the File History tool to recover your files, or restore your file from an older backup.

How to repair files using cmd? ›

In the command prompt window, type SFC /scannow and press Enter . The system file checker utility checks the integrity of Windows system files and repairs them if required. After the process is complete, reboot the computer.

Which command can be used to restore a deleted file? ›

CHKDSK and attrib commands are widely used in recovering files. They also work well in rescuing files from formatted hard drives.

How to recover deleted files using attrib command? ›

Press the “Windows + X” keys, then select “Windows PowerShell (Admin)”.
  1. Enter “attrib -h -r -s /s /d G:\*. ...
  2. Download Windows File Recovery from the Microsoft Store by clicking “Get”, then install it on your PC.
  3. Enter “Windows File Recovery” in the search bar. ...
  4. Hover the mouse over the USB, and click Scan.

How to recover permanently deleted files using cmd? ›

Now, in the Command Prompt window, type chkdsk 'drive letter:' /f and then press the Enter key. For instance, C:\USER\PROGRAM FILE\chkdsk D: /f. Press Y and wait till the command lines start again recover permanently deleted files using Command Prompt. After that, you have to type drive letter again and then hit Enter.

Can I recover permanently deleted files from my PC? ›

Press the Windows key, enter Windows File Recovery in the search box, and then select Windows File Recovery. When you are prompted to allow the app to make changes to your device, select Yes. There are 2 basic modes you can use to recover files: Regular and Extensive.

How to recover data through command prompt? ›

3. Recover Files from RAW Drive Using chkdsk and rescan Command
  1. On the command window, type chkdsk drive letter: /r/f (e.g., chkdsk d: /r/f) and hit Enter.
  2. On the command prompt window, type diskpart, and then hit on Enter.
  3. Type rescan and then hit enter.
  4. Exit DiskPart, type chkdsk /f d: in CMD and hit Enter.
Jul 24, 2024

How to use CHKDSK to recover files? ›

CHKDSK is not a data recovery tool and will not repair corrupted files or recover lost or damaged files. But it does check if the state of the information on your disk is safe and consistent, and CHKDSK can help you repair formatting issues with your hard drive.

Can you recover corrupted files? ›

Whether you have a Word document or an Excel spreadsheet containing invaluable work data or a treasured set of personal photos, receiving this error message can easily cause panic. Not to worry—all is not lost. Corrupted files can be restored, and the process is made even easier if you use the right software.

How do I recover accidentally deleted files? ›

Navigate to the folder that used to contain the file or folder, right-click it, and then select Restore previous versions. If the folder was at the top level of a drive, for example C:\, right-click the drive, and then select Restore previous versions.

Can deleted files really be recovered? ›

Can files be recovered once deleted? Yes, files can be recovered after being deleted. The level of difficulty depends on how long ago the file was deleted, however, and you may need to use specialized tools if trying to recover data that has been corrupted.

How do I recover immediately deleted files? ›

Go to the Windows search bar and type "Restore your files with File History." Locate the file you want to regain. There could be more than one version! Click the version of the file and click Restore.

Is there a free way to recover deleted files? ›

EaseUS Data Recovery Wizard Free, powered by AI, restores deleted files for free. It only takes 3 steps to search for deeply buried files, and find and list out any video, photo, music, and document that it can scan. Preview before recovery is supported. No need to pay if your files are not found.

Which DOS command recover deleted file? ›

The UNDELETE command can only recover deleted files if no new files or changes have been made on the disk since the deletion. Therefore, if you accidentally delete a file that you want to keep, stop what you are doing immediately and use the UNDELETE command to retrieve the file.

Which tool is used to recover deleted files? ›

EaseUS Data Recovery Wizard is an ideal choice as data recovery software for both Windows and Mac. Powered by AI, it can undelete files from internal or external hard drives, SSDs, memory cards, and formatted USBs.

Are permanently deleted files gone forever? ›

Are permanently deleted files gone forever? When you delete a file or folder from your computer, it doesn't simply disappear from existence. Even if you immediately empty the Recycle Bin or the Trash folder, all your deletion does is mark the space that the file takes up on your hard drive as vacant.

Where does permanently deleted files go? ›

For Windows computers, deleted files go to the Recycle Bin. On macOS machines, they go to the Trash. And for Android and iPhone devices, files are stored in the phone's memory until they are overwritten by new data.

How to recover permanently deleted files not in Recycle Bin? ›

If you have backed up your data with Windows Backup, you can use it to recover deleted files not in Recycle Bin without much difficulty. Step 1: Go to Settings > Update & Security > Backup. Step 2: In this section, choose "Go to Backup and Restore (Windows 7)". Step 3: Click "Restore my files" to get the work done.

When a file is deleted it can never be recovered? ›

When Windows deletes a file, it moves it to a specific hard drive sector and hides it from the operating system. Even after emptying the Recycle Bin, there is still a chance of data recovery if no new data is written on those specific sectors where the deleted files exist.

Top Articles
Nine tips to cut petrol costs and save on fuel - Times Money Mentor
Crypto FAQ | M1 Help Center
Davita Internet
Ffxiv Palm Chippings
Research Tome Neltharus
Valley Fair Tickets Costco
Mohawkind Docagent
Emmalangevin Fanhouse Leak
Mndot Road Closures
Erskine Plus Portal
13 The Musical Common Sense Media
World Cup Soccer Wiki
Craigslist Heavy Equipment Knoxville Tennessee
Edible Arrangements Keller
Slag bij Plataeae tussen de Grieken en de Perzen
Oscar Nominated Brings Winning Profile to the Kentucky Turf Cup
Love In The Air Ep 9 Eng Sub Dailymotion
Leader Times Obituaries Liberal Ks
Committees Of Correspondence | Encyclopedia.com
Huntersville Town Billboards
Timeforce Choctaw
Ford F-350 Models Trim Levels and Packages
Routing Number For Radiant Credit Union
Bn9 Weather Radar
City Of Durham Recycling Schedule
Urbfsdreamgirl
Truvy Back Office Login
Table To Formula Calculator
Sandals Travel Agent Login
Orange Park Dog Racing Results
Neteller Kasiinod
Maths Open Ref
DIY Building Plans for a Picnic Table
Have you seen this child? Caroline Victoria Teague
Steven Batash Md Pc Photos
Tamil Play.com
Atlantic Broadband Email Login Pronto
Spinning Gold Showtimes Near Emagine Birch Run
Oreillys Federal And Evans
Asian Grocery Williamsburg Va
Afspraak inzien
Directions To 401 East Chestnut Street Louisville Kentucky
Academic important dates - University of Victoria
Gpa Calculator Georgia Tech
Housing Intranet Unt
T&Cs | Hollywood Bowl
St Vrain Schoology
Online College Scholarships | Strayer University
Nurses May Be Entitled to Overtime Despite Yearly Salary
Understanding & Applying Carroll's Pyramid of Corporate Social Responsibility
Unpleasant Realities Nyt
Tyrone Unblocked Games Bitlife
Latest Posts
Article information

Author: Kimberely Baumbach CPA

Last Updated:

Views: 5960

Rating: 4 / 5 (41 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Kimberely Baumbach CPA

Birthday: 1996-01-14

Address: 8381 Boyce Course, Imeldachester, ND 74681

Phone: +3571286597580

Job: Product Banking Analyst

Hobby: Cosplaying, Inline skating, Amateur radio, Baton twirling, Mountaineering, Flying, Archery

Introduction: My name is Kimberely Baumbach CPA, I am a gorgeous, bright, charming, encouraging, zealous, lively, good person who loves writing and wants to share my knowledge and understanding with you.