Restore a Deleted Folder in Windows Using Command Prompt (2025 Guide)


Accidentally deleting an important folder on your Windows PC can be a stressful experience, especially if it contains crucial documents, project files, or personal memories. Fortunately, there are multiple ways to recover lost data โ€” and one of the most powerful yet underrated methods is using the Command Prompt (CMD). In this comprehensive guide, weโ€™ll show you exactly how to restore a deleted folder in Windows using Command Prompt, step-by-step, even if youโ€™re not a tech expert.


Table of Contents


Introduction

 restore a deleted folder in Windows

The Restore a deleted folder in Windows using Command Prompt, often known simply as CMD, is a built-in Windows utility that lets you execute text-based commands to perform system-level tasks. While many users rely on graphical interfaces or third-party tools for file recovery, CMD is incredibly powerful and can restore hidden, lost, or accidentally deleted folders in many situations.

Using CMD to restore a deleted folder in Windows offers several advantages:

  • No installation required: CMD is already built into Windows.
  • Direct control: You interact directly with the file system.
  • Advanced capabilities: CMD can reveal hidden files, repair file structures, and restore lost data.

Letโ€™s start with the first and most basic step: checking if your deleted folder is still in the Recycle Bin.


Step 1: Check the Recycle Bin Before Using CMD

Before diving into CMD-based solutions, itโ€™s worth verifying whether the deleted folder is simply in the Recycle Bin. Hereโ€™s how:

  1. Open the Recycle Bin from your desktop.
  2. Search for the folder by name.
  3. If found, right-click > Restore to recover it.

If the folder isnโ€™t there, or you used Shift + Delete (which bypasses the Recycle Bin), move on to the command-line recovery methods below.


Method 1: Use the ATTRIB Command to Restore a Deleted Folder

The attrib command is one of the most effective ways to restore a deleted folder in Windows using Command Prompt. This command changes file attributes and can help you reveal and recover hidden or system-protected files.

Steps to Use ATTRIB:

  1. Press Win + R, type cmd, and press Ctrl + Shift + Enter to open CMD as administrator.
  2. Navigate to the drive where the folder was deleted. For example: cd D:\
  3. Run the following command: attrib -h -r -s /s /d *.*

Explanation of switches:

  • -h: Removes the hidden attribute.
  • -r: Removes the read-only attribute.
  • -s: Removes the system attribute.
  • /s: Applies the command to all files in subdirectories.
  • /d: Includes directories.

Result: If the deleted folder was hidden or marked as a system file, it will reappear in its original location.


Method 2: Restore Deleted Folders with File History (CMD Shortcut)

If you have File History enabled in Windows, you can restore a deleted folder in Windows, even through CMD.

Steps:

  1. Open CMD as administrator.
  2. Type the following command: control /name Microsoft.FileHistory
  3. This will open File History. Click Restore personal files.
  4. Browse to the folder and click the green restore button.

Even though this method uses a GUI step, launching File History from CMD is faster and often overlooked.


Method 3: Use Robocopy to Recover Deleted Folders from Backup

The Robocopy command is a robust file copy utility that can also be used to restore a deleted folder in Windows,โ€” provided you have a backup or mirror copy of your drive.

Example Command:

robocopy "E:\Backup" "C:\Recovered" /E /Z /COPYALL

Explanation:

  • E:\Backup โ€“ The source drive or folder where the backup exists.
  • C:\Recovered โ€“ Destination where files will be restored.
  • /E โ€“ Copies all subdirectories, including empty ones.
  • /Z โ€“ Enables restartable mode (resumes if interrupted).
  • /COPYALL โ€“ Preserves all file information (timestamps, permissions, etc.).

This is especially useful for IT admins and advanced users managing system backups.


Method 4: Run CHKDSK to Recover Lost Directories

If your deleted folder is missing due to disk corruption or a logical error, CHKDSK can help fix the issue and potentially restore the folder.

  1. Open CMD as administrator.
  2. Type the following: chkdsk C: /f
  3. Replace C: with the drive letter where the folder was deleted.

CHKDSK will scan and repair the file system. After the process, check your drive โ€” sometimes, recovered files appear in a new folder called FOUND.


Method 5: Restore Using Shadow Copies and CMD

Windowsโ€™ Volume Shadow Copy feature automatically creates snapshots of your files. If enabled, you can recover deleted folders by accessing previous versions.

Steps:

  1. Run CMD as administrator.
  2. Type: vssadmin list shadows
  3. Note the snapshot ID or creation date.
  4. Use robocopy to copy the folder from the shadow copy to your current drive.

This is an advanced method but extremely powerful for restoring older deleted folders.


Pro Tips to Prevent Accidental Folder Deletion

  • Enable File History or OneDrive Backup for continuous protection.
  • Use Recycle Bin confirmation prompts to avoid accidental deletion.
  • Create regular system restore points.
  • Use cloud storage or external drives for redundant backups.

Best Data Recovery Tools (If CMD Doesnโ€™t Work)

If none of the CMD methods succeed, you might need professional data recovery tools. Here are some top recommendations:

  1. Recuva: A free, beginner-friendly tool for recovering deleted files and folders.
  2. Disk Drill: Offers deep scan and preview options for lost files.
  3. R-Studio: A professional-grade tool ideal for formatted drives and severe data loss.
  4. EaseUS Data Recovery: A user-friendly solution for recovering deleted partitions and folders.

Frequently Asked Questions (FAQ)

1. Can I restore a permanently deleted folder using Command Prompt?

Yes, in many cases you can restore a permanently deleted folder using the attrib, robocopy, or chkdsk commands. However, success depends on whether the data sectors have been overwritten.

2. Does CMD work if the folder was deleted a long time ago?

It depends. If the disk space hasn’t been overwritten, CMD may still be able to recover it. Otherwise, you may need professional recovery software.

3. How do I open Command Prompt as administrator?

Press Win + S, type cmd, right-click on โ€œCommand Prompt,โ€ and select Run as administrator.

4. Can I recover folders from an external drive with CMD?

Yes, CMD works with external drives too. Just replace the drive letter in your commands with the external driveโ€™s letter.

5. What should I avoid after deleting a folder?

Avoid writing new data to the same drive, as it may overwrite the deleted files, making recovery impossible.


Leave a Reply

Your email address will not be published. Required fields are marked *