Restore a deleted folder in windows using command prompt​

Accidentally deleting a folder in Windows can feel like a mini-crisis especially if that folder contained irreplaceable photos, crucial work documents, or long-term project files. While modern versions of Windows have evolved to include built-in protections like the Recycle Bin, mistakes still happen. But what if the folder bypassed the Recycle Bin altogether, or you’ve already emptied it?

One powerful but underutilized tool in Windows is the Command Prompt (CMD). Often seen as a tool for power users and IT professionals, CMD can be surprisingly effective at restoring deleted folders especially when combined with Windows’ hidden capabilities, recovery features, and third-party utilities that can be run from the command line.

Chapter 1: Folder Deletion in Windows

1.1 How Files Are Deleted in Windows

When a folder is deleted:

Soft Delete: Moved to Recycle Bin (still recoverable)

Hard Delete: Permanently removed (Shift + Delete or too large for Recycle Bin)

1.2 Where Deleted Data Goes

Not immediately removed Windows simply marks the space as “available”

Until overwritten, data may still be recoverable

Chapter 2: When to Use Command Prompt

CMD is useful when:

Graphical tools fail

You’re on a restricted or minimal UI system

You want to script automated recovery

Working with third-party command-line recovery tools

Chapter 3: Preliminary Steps

3.1 Open Command Prompt as Administrator

Click Start, type cmd

Right-click Command Prompt

Choose Run as administrator

Running CMD as admin gives full access to system paths and protected partitions.

Chapter 4: Check the Recycle Bin Using CMD

Although the Recycle Bin isn’t easily accessible via CMD, you can still attempt a basic check:

cmd

cd $Recycle.Bin dir /a

Or try:

cmd

cd C:\$Recycle.Bin

This only works if the deleted folder was moved to Recycle Bin and hasn’t been emptied. The files may appear under cryptic names.

Chapter 5: Use Windows File History (if enabled)

File History backups can be restored using CMD.

5.1 Enable File History (For Future Recovery)

cmd

control /name Microsoft.FileHistory

5.2 Restore From File History (Using CMD Script)

If you know the folder path:

cmd

Robocopy “\\\\” “C:\Users\\Documents” /E

Or use PowerShell via CMD:

cmd

powershell -command “Restore-FileHistory -Path ‘C:\Users\\Documents\ProjectFolder'”

Chapter 6: Use ATTRIB Command to Unhide Lost Folders

Sometimes a folder isn’t deleted but marked hidden or system-protected.

6.1 Run ATTRIB

cmd

attrib -h -r -s /s /d C:\Users\\Documents\*

-h: Removes hidden attribute

-r: Removes read-only

-s: Removes system attribute

/s /d: Applies to subfolders and files

This can make “invisible” folders visible again.

Chapter 7: Use CHKDSK to Locate Lost Fragments

Corruptions and deletions sometimes leave behind fragments that can be rebuilt.

7.1 Run CHKDSK

cmd

chkdsk C: /f /r

/f: Fixes disk errors

/r: Locates bad sectors, attempts recovery

Afterward, check if recovered folders appear in a found.000 directory:

cmd

dir C:\ /a

These might contain .chk files, which can be partially restored with recovery tools.

Chapter 8: Using Windows Previous Versions via CMD

If you’ve enabled System Protection, folders may have shadow copies available.

8.1 Check Restore Points

cmd

vssadmin list shadows

Or:

cmd

wmic shadowcopy list brief

8.2 Mount and Copy from Shadow Copy

Use tools like ShadowCopyView or scripts to mount and copy content from shadow copies:

cmd

mklink /d C:\RecoveredShadow “\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Users\\Documents”

Chapter 9: Recover Deleted Folder Using Robocopy and Shadow Copies

Here’s a real-world example of restoring a folder from a shadow copy.

cmd

robocopy “\\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy1\Users\\Documents\MyDeletedFolder” “C:\Users\\RecoveredFolder” /E

Copies the deleted folder from shadow backup to a new location.

Chapter 10: Using Third-Party Recovery Tools with CMD Interface

Panda Assistant is a powerful, user-friendly tool designed to help users recover lost, deleted, or inaccessible files from a wide range of storage devices. Whether you’re dealing with a corrupted SD card, an accidentally formatted USB drive, or missing documents from your computer’s hard disk, Panda Assistant offers a reliable and efficient solution to bring your data back.

One of the key strengths of Panda Assistant lies in its intuitive interface. Even users with limited technical knowledge can easily navigate through the recovery process with step-by-step instructions. Simply launch the software, select the affected drive, and let Panda Assistant scan for recoverable files. The tool supports the restoration of documents, photos, videos, music files, and more making it ideal for both personal and professional use.

11.1 Search for Folder by Name

powershell

Get-ChildItem -Path C:\ -Recurse -Force -ErrorAction SilentlyContinue | Where-Object {$_.Name -like “*MyDeletedFolder*”}

11.2 Recover Using PowerShell Copy

powershell

Copy-Item -Path “E:\Recovered\MyDeletedFolder” -Destination “C:\Users\\Documents” -Recurse

Chapter 12: Preventing Future Folder Loss

12.1 Turn On File History

cmd

control /name Microsoft.FileHistory

12.2 Schedule Backups

Use Task Scheduler and CMD to automate:

cmd

robocopy C:\Users\\Documents E:\Backups\Documents /MIR /E /R:2 /W:5

12.3 Enable System Restore Points

cmd

SystemPropertiesProtection

Chapter 13: Summary of Useful CMD Commands

While Command Prompt might seem intimidating to casual users, it holds immense power for those looking to recover deleted folders especially when standard graphical tools fall short. From restoring hidden files using attrib, repairing file systems with chkdsk, accessing shadow copies, or integrating advanced recovery tools like PhotoRec, CMD offers a robust, flexible, and fast route to data recovery.

The key is to act fast. The longer you wait, the more likely Windows will overwrite the deleted data. Combine that urgency with the techniques covered here, and you’ll greatly increase your chances of restoring your lost folders.

About us and this blog

Panda Assistant is built on the latest data recovery algorithms, ensuring that no file is too damaged, too lost, or too corrupted to be recovered.

Request a free quote

We believe that data recovery shouldn’t be a daunting task. That’s why we’ve designed Panda Assistant to be as easy to use as it is powerful. With a few clicks, you can initiate a scan, preview recoverable files, and restore your data all within a matter of minutes.

Subscribe to our newsletter!

More from our blog

See all posts