How to recover a hidden file using MS DOS command

This article will help to recover the hidden file which goes hidden when the file get affected by virus. Such type of files can be cleaned by antivirus but some files cannot be recovered from hidden status. By using MS DOS command, the hidden files can be recovered to its original position. Even we cannot able to recover in Windows, we can recover using MS DOS command.


The files can be go for a hidden status by manual or by a virus affect. If the file is set as hidden by manual, we can recover by clicking Tools – Folder options – view – show hidden files and folders. This kind of setting will help not to share a particular folder or file to another user. Due to virus affect, some files or folders will go for a hidden status. After cleaning the virus also, there are chances of some files and folders will remain in hidden status. Using MS DOS command, we can recover that kind of hidden files and folders to normal visible mode.

Virus problem in pen drive and memory card

When we using Pen drive or memory card to store data in a computer, there are chances of virus affect. There are some virus which will create the same name of that particular folder or file in the drive and it will hide the original file and folder. So if we click that virus folder, there will not be any files or content. So we will assume that the pendrive or memory card is affected by virus and we will format the drive. But the fact is, the files will be there in the drive but with hidden status. If we check the memory of the drive, it will show used memory but the files or folders can not be visible. Even if we apply the setting to show hidden file under the Tools menu to change the status, we cannot see the file or folder. Now we will see how to recover hidden files and folders by using MS DOS command.

Executing command to recover hidden file or folder

'Attrib' is the command name to recover the hidden file. 'Attrib' is short form of Attribute. By using attrib command, we can set or remove the status as hidden or read only or system file. We will see how to use Attrib command to recover the file.

Steps to recover hidden file or hidden folder

As I mentioned that Attrib is a MS DOS command, so we have to go command prompt.

Click start
click Run
Now type: command

A screen will appear which is called DOS prompt. Now you will see c:/folder name. Now type the drive name which you want to change the status of folder or file. For example, if you want the change the status of file or folder in your pen drive, type g: or f: which is assigned to pen drive. Now you will see the drive letter in the prompt. If you want to see the hidden files in your pen drive, type: dir / ah. It will list all the files and folders which are in hidden status. You can remove the hidden status one by one by using the following command.

Type the following:

Attrib –s –h –r filename

suppose the file name is 'docwrite'
Type the following.
Attrib –s –h –r docwrite

'-s' is used to remove the status of system file
'-h' is used to remove the status of hidden file
'-r' is used to remove the status of read-only file

After the above command is executed, the specified file will be recovered from hidden status. You can check this in the Windows screen. Like that each and every file can be changed from hidden status to visible mode.

Suppose there are chances that a particular folder will be in hidden status. The command dir /ah will list all the hidden files and folders, note the folder name and type the command as mentioned above by giving the folder name. For example, the folder name is 'helpdir', now type the following:

Attrib –s –h –r helpdir

This will change the status from hidden to normal visible mode. Thus any file or folder can be changed to normal visible mode.

Steps to hide a file or folder using MS DOS command

This Attrib command can be used vice versa also. I mean you can change a file or folder to hidden mode. Type the following command to change the file or folder to hidden status.

Attrib +h Filename

Attrib +h docwrite

Now the 'docwrite' file will be in hidden status. You can see the status of all files in a particular folder. Type 'attrib' in a particular folder or file. It will list all the files with the status. If it is a system file, it will show 'S', if it is a hidden file, it will show 'H'. If it is a read-only file, It will show 'R'. Like that we can know the status of a file.


By using this Attrib command, we can remove the hidden status and read-only status in the MS DOS prompt. This will help when a file or folder is affected by virus. So without formatting, we can recover our hidden file and folder back to normal visible mode.

Related Articles

How To Control Anger?

Have you ever been angry and later on felt sad for being angry on some one or something? Do you want to control your anger ? Is anger good or not ? The following article will discuss about anger and measures through which we can control our anger.

How to attend phone Interview

Looking for tips on how to be effective during a phone interview for a job? This article provides useful tips for novices who are participating in their very first phone interview with a prospective employer.

How To Diagnose and Prevent Dengue Fever

This article tells about the expressions of Dengue fever and how to understand if a person is suffering from Dengue fever. Also read further to know about the investigations for Dengue Fever and treatment for Dengue fever.

How to decide on a Career

Are you confused about how to choose a career and is it creating a lot of tension in deciding about where to go? Read this article to get an idea in short about how to think and decide about your future career.

How to study for exams?

Are you looking for correct ways to study and prepare for exams? This article gives you tips with examples on how to study for exams.

More articles: How to


Author: Deepak Yadav15 Jul 2011 Member Level: Gold   Points : 1

You can also use attrib +h +i filename to hidden a specify file and if want to unhide you use attrib -h -i filename .

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: