Use CMD to recover files from virus infected storage media

Data Recovery


Virus attacks are becoming a common thing and most of us have had an experience or two with them in the past, while some of us are experiencing it right now. Virus attacks usually always result in unexpected data loss from your USB drive, memory card and hard drive. Most people don’t know how to recover their data which becomes quite a nightmare. There are so many ways to recover the files you lose due to viruses, my favorite way that I find simple and easy is by using the command prompt. You need to follow some simple steps that are simply straightforward and it is always a guarantee you will recover your files. I find it convenient because it is free, easy and do It yourself.

Step 1

You need to plug in the drive with the files you want to recover, these include the memory card, USB drive, or hard drive.

Step 2

On your windows device is the start menu, you need to click on the search bar and type ‘cmd’. When you click the enter button, listed as programs is ‘cmd.exe’.

Step 3

Virus attacksOn the ‘cmd.exe’ right click, a small command window will pop up. This is the command prompt that will help you recover your infected files. You now need to type “attrib -h -r -s /s /d letter of the drive you want to recover:\*.*”. Let’s assume the drive you want to recover virus infected files from is designated as G by your computer, then you will key in the following “attrib -h -r -s /s /d G:\*.*”.

Step 4

Wait for windows to finish recovering your files. This process usually takes a couple of minutes and you need to wait patiently. Do not close the window until the process is finished. At this point, all you need to do is go to your drive or card and check whether your files have been recovered. Congratulation, you are all done and can now access the data that was previously lost and inaccessible.


Using CMD to recover files lost due to virus infections, is quite a simple way and should always be your first resort. It, however, does not guarantee that you will always get back your data. Some viruses eat up your data and you may need to resort to third-party software for recovery. There are so many recovery software available and they are also quite simple to use. You will always recover your files from virus infection and you should not despair. If you cannot manage to retrieve your information, you could seek out help from your local computer professional services. To avoid viruses try installing an authentic antivirus software.