Deleting files to create space for others is a normal practice for most people. There are instances where the deleted files suddenly become important and people go into frantic effort to get them back. In some other instances, files are mistakenly deleted permanently from a device, putting the individual in a very critical condition. If you are currently looking for ways to recover deleted files using CMD (Command Prompt), this is the right place to be.
The Command Prompt is one of the most powerful inbuilt utility tools in Windows. It can be used to troubleshoot and fix most issues relating to Windows. Additionally, a correct command line can help you recover deleted files from both local hard disks and external storage devices without the help of third-party software.
Let's check how Command Prompt makes things possible.
There are times you may unintentionally delete a file from an external hard drive or flash drive. But don't worry, you can follow these steps to retrieve deleted files from external hard drive using attrib command in Windows 11/10/8/7.
Step 1: Press Windows + R key simultaneously and type in CMD.
Step 2: In the pop-up window, type [chkdsk "drive letter" /f] and press Enter.
Step 3: Press Y (yes) until the command line starts again.
Step 4: Type the drive letter again and press Enter.
Step 5: Type [drive letter : \ >attrib –h –r –s /s /d *.*]. Then all the lost and deleted files in the external storage device will be retrieved.
1. Once the process gets finished, a new folder will be created on the drive to store all the recovered files. Since all the files will be available in .chk format, you have to change the file extension by yourself and save each file at the preferred location.
2. There could be a circumstance where you see an "access denied" error under each directory. If that's the case, follow the steps below to fix it:
Be sure that you run CMD as administrator.
Check if the file is in use. If the file is opened by another program, the "access denied" error will arise.
Make sure you have full control of the file. You can check it from file properties.
This error would occur if there is a problem with the hard drive. You can use the command CHKDSK X: /f to check if there is an error on your hard drive.
If option 1 doesn't work for you, try this method. But please note that this method only works when the deleted files have been moved into Recycle Bin and kept there. If the files were deleted via CMD or by pressing Shift+Delete key, then they won't show up in the Recycle Bin folder for you to use this method. Furthermore, this method won't work if you accidentally emptied Recycle Bin after the deletion.
Now, follow the steps below to recover deleted files from Recycle Bin with CMD.
Step 1: Type cmd in the search bar.
Step 2: Right-click on Command Prompt utility and run it as administrator.
Step 3: Type the following command in the CMD window: start shell:RecycleBinFolder and press Enter.
Step 4: The Recycle Bin folder will pop up. Locate the file you want to recover and restore it to the original location on your computer.
Nowadays, we spend a lot of time surfing the Internet every day. And some of us would download some free or cracked programs from unofficial websites, which will increase the risk of infecting viruses. Once your computer has been infected by a virus, some files will be deleted. And if you connect any external storage devices to your computer, the files on your external devices will also be deleted as well.
Luckily, there is a way to remove virus from computer with CMD. Here's how:
Step 1: Run Command Prompt as administrator.
Step 2: Type the drive letter of the disk infected with virus then hit Enter.
Step 3: Type del *.lnk and hit Enter (you can also type ATTRIBUTE -H -R -S AUTORUN.INF and hit Enter to delete the autorun.inf file)..
Step 4: Type attrib -s -r -h *.* /s /d /l and hit Enter. It may take some time for this process to complete.
One can also run the attrib -h -r -s /s /d command to unhide files hidden by virus.
Powerful and handy as Command Prompt is, there are some instances where it does not work. For example, when your computer crashed, you emptied the Recycle Bin, or you formatted the hard drive. Besides, Command Prompt hardly accepts any mistake because a little mistake on the command line will cause damage to your operating system and existing data.
For those reasons, many people are also pursuing a reliable alternative to Command Prompt. And here no other tools provide a better answer than AnyRecover.
AnyRecover is a professional data recovery tool designed to solve all kinds of data loss issues for everyone. And it's compatible with the newest Windows operating system, Windows 11. Following are some impressive features of it.
Works perfectly in alomost every data loss scenario, including emptied Recycle Bin, RAW hard disk, crashed computer and formatted SD card.
Supports 1000+ file types including images, videos, documents, audio files, emails and archives.
Recovers data from any storage device such as internal hard disk, external hard drive, USB drive, memory card, and SSD.
Provides fast and deep scan on the selected location, which ensures high success rate.
Takes only 3 simples steps to perform data recovery and is suitable for every user.
AnyRecover offers a free trial that enables user to perform a deep scan, preview and recover .
Step 1. Download, install and open AnyRecover on the computer. Choose a location to recover the deleted files, then click "Start" to begin the scanning process.
Step 2. The program will start an all-round and deep scan right away.
Step 3. Once it's done, find the files you need. Preview them and click the "Recover" button to get them back.
You can also check this video guide to know more about recovering deleted files with AnyRecover.
Sometimes when ransomware or virus is blocking Safe Mode, the only way left to perform a System Restore is using Command Prompt.
Step 1: During the computer start process, press F8 key on your keyboard a couple of times until the Windows Advanced Options menu appears, from which select "Safe Mode with Command Prompt" and press Enter.
Step 2: In the Command Prompt window, enter the following line: cd restore and press Enter.
Step 3: Next type in: rstrui.exe and press Enter.
Step 4: Click "Next" in the pop-up window. Then select one restore point and click "Next" to proceed.
Step 5: Comfirm the system restore by hitting the "Yes" button.
There are several reasons that will cause a corrupted hard disk, for example, improper operations and external damage. CMD is an advanced tool that can check and fix the errors on your hard disk. Check the steps below:
Step 1: Use the search function from the bottom-left of the Windows taskbar and type "cmd" to open Command Prompt as administrator.
Step 2: In the command prompt windows, type: sfc /scannow and press Enter. Then Windows would locate and repair the errors.
Step 3: If there are no issues, close the Command Prompt. If there are, proceed by typing: dism /online /cleanup-image /restorehealth and hit Enter. Wait and then restart your PC.
The 3 options regarding recovering deleted files via CMD apply to different scenarios respectively and cannot always work. While the ideal alternative AnyRecover provides a universal and comprehensive solution to a great variety of data loss issues. Recovering almost all lost data instanly without imposing any risks on the data itself or other software on your computer, AnyRecover definitely deserves a try.
Start a deep scan for free right now!