Show files hidden by a computer virus using command prompt

Edited by Michael J., Eng, Maria, Alma and 22 others

There are two common ways to unintentionally lose your valued computer files; either you messed them up or something else did. If you are certain you aren't the culprit, there is usually only one other cause - a computer virus. Before you panic at the idea of losing your files forever, you need to check to see if they are indeed lost or just hidden from plain sight.

This article will guide you through the process of restoring hidden files via Windows Command Prompt.

Was this helpful? Yes | No
Ad

Instructions

  1. 1
    Open Command Prompt, which can be done a number of ways
    .
    You can choose whatever method you prefer from the options below.
    Advertisement
     
    1. Click on the Windows Key (or Start button) and type in "cmd" in the Search Bar and hit Enter.
      Cmd search bar.png
    2. Click on the Windows Key (or Start button) and type in "run" in the Search Bar and hit Enter. A dialog box will appear. Type in "cmd" in the input field and hit Enter.
      Cmd run dialog.jpg
    3. Alternatively, you can press the Windows Key + R on your keyboard simultaneously. This is a shortcut method for invoking the Run dialog box.
    Was this step helpful? Yes | No
  2. 2
    Type in the letters "CD\" (without the quotes) and hit Enter
    .
    Cd cmd.png
    Advertisement
    Was this step helpful? Yes | No
  3. 3
    Type in the Drive Letter which stores the files you want to unhide, plus a colon, and then hit Enter
    .
    In this example, we will try to navigate to Drive "F:"
    Cd drive f.png
    Was this step helpful? Yes | No
  4. 4
    Type in the following "dir/ah" (without the quotes)
    .
    This will list all the hidden files in the current directory (Drive F:) and display them in the command prompt. However, this command does not restore the hidden files. This only allows you to check if your "lost" files are really lost, or just hidden inside the directory. If your files are indeed listed, then you can proceed to the next step to restore them.
    Cmd dir ah.png
    Was this step helpful? Yes | No
  5. 5
    For the last part, type in ("attrib *
    .
    -h -s /s /d") (without the quotes/brackets) and hit Enter. This command will "officially" unhide the files hidden by the computer virus.
    Cmd attrib.png
    Was this step helpful? Yes | No
  6. 6
    The command prompt may seem unresponsive while the unhide command is being performed
    .
    This is normal, especially if there are a lot of files involved. Please be patient and wait until the blinking cursor resurfaces.
    Was this step helpful? Yes | No
  7. 7
    Please Note: If you are getting "access denied" reply, you will need to re-open the Command Prompt with administrator access and redo the commands listed below
    .
     
    1. To load the Command Prompt with administrative access,
    Was this step helpful? Yes | No

Tips Tricks & Warnings

Questions and Answers

How to unhide file in PC from cmd?

To unhide a file on your PC using CMD, please do the following.

  1. 1
    Press Windows key and R on your keyboard simultaneously, then type "cmd" without the quotes then hit enter.
    Was this step helpful? Yes | No
  2. 2
    Type in CD\ and hit Enter.
    Was this step helpful? Yes | No
  3. 3
    To find the directory of the folder where the hidden file is located, e.g if your hidden file is located in Documents folder type "CD\Users\username\Downloads\Documents" (without the quotes) and then hit Enter.
    Was this step helpful? Yes | No
  4. 4
    Then type ("attrib *
    .
    -h /s /d") without the quotes/brackets then hit Enter to unhide the files hidden in the folder.
    Was this step helpful? Yes | No
  5. 5
    That's it.
    Was this step helpful? Yes | No
  6. 6
    Note
    :
    If you are getting "access denied" reply, log-in as administrator on your PC.  
    1. If you are already logged in as the administrator, you will need to run the Command Prompt as administrator.
    Was this step helpful? Yes | No

How do I unhide my files, they were hidden by the virus but after the scan and removal of the virus?

My PC was infected with a virus which caused my files to be hidden. I used my anti-virus program to remove the virus. However, my files are still hidden. What can I do?

Once you have successfully erased the virus, you can easily unhide your files from the Windows control panel.

Follow the steps below to unhide your folders:

For Windows 7 Users

  1. 1
    On your desktop, click on the 'Start' menu.
    Was this step helpful? Yes | No
  2. 2
    Select 'Control Panel'.
    Was this step helpful? Yes | No
  3. 3
    Click on the 'Appearance and Personalization' option.
    Was this step helpful? Yes | No
  4. 4
    Select 'Folder Option'.
    Was this step helpful? Yes | No
  5. 5
    Click on the 'View' tab.
    Was this step helpful? Yes | No
  6. 6
    Now scroll down to the 'Hidden files and folders' section.
    Was this step helpful? Yes | No
  7. 7
    Select the 'Show hidden files' option.
    Was this step helpful? Yes | No
  8. 8
    Click on the 'OK' button.
    Was this step helpful? Yes | No
  9. 9
    Your files should now be unhidden
    .
     
    1. If you're still unable to view your files, follow the instructions in our main guide.
    2. If you need more help un-hiding your files, let us know in the Q&A section below.
    Was this step helpful? Yes | No

For Windows 10 Users

  1. 1
    Left-click on the "Start" menu.
    Was this step helpful? Yes | No
  2. 2
    Left-click on the "Settings" icon.
    Was this step helpful? Yes | No
  3. 3
    Left-click on the "Find a setting" search box.
    Was this step helpful? Yes | No
  4. 4
    Type in "Show hidden".
    Was this step helpful? Yes | No
  5. 5
    Left-click on "Show hidden files and folders"
    .
    Was this step helpful? Yes | No
  6. 6
    In the File Explorer Options pop-up window, locate the "Hidden files and folders" area.
    Was this step helpful? Yes | No
  7. 7
    Left-click on the circle beside "show hidden files, folders, and drives".
    Was this step helpful? Yes | No
  8. 8
    Left-click on the "OK" button.
    Was this step helpful? Yes | No
  9. 9
    All hidden files and folders should now be unhidden
    .
     
    1. If you're still unable to view your files, follow the instructions in our main guide.
    2. If you need more help un-hiding your files, let us know in the Q&A section below.
    Was this step helpful? Yes | No
    Advertisement

How to remove the virus permanently?

I use McAfee antivirus even though I scan the drive, it produces the null virus; but after also my system do the malfunctions like while inserting the pen drive it shows *.exe file and it's dynamically changing the data. Please help for this. I have tried: I didn't try anything

Was this helpful? Yes | No

Antivirus programs do not see all types of threats. To cover the entire range of threats that can harm your computer, you will need to download the following programs:

After you download both programs, start with installing Malwarebytes' Anti-Malware. Let it update its databases and click the "Scan" tab. Insert your flash drive into your computer. Select "Threat Scan" and click "Start Scan". After it has checked the drives, reboot the system and repeat the same scanning procedure over again.

Was this helpful? Yes | No

Then, move on to Spybot: Search and Destroy. After installing it, right-click the icon in the system tray. Choose "Update". Click "Update" once new update files have been found. Then, close the window. Right-click the icon of Spybot in the system tray again. Click "System Scan". Click "Start a scan". After the scan has been completed, reboot the computer and rescan the system.

Was this helpful? Yes | No

Hi how do I find hidden virus files on my laptop?

I had to contact a Windows team because my laptop came up with a blocked message. They explained the virus is a common virus and there are numerous errors in our hard drive. I have run many different scanners through our laptop with no hits on these errors nor the virus. So I was thinking it is a hidden folder, cookie or something as such. hope you can help!

Was this helpful? Yes | No

Hello. Please follow the above how-to guide and make sure that you follow each step very carefully. Regardless if you have a laptop or desktop, the guide above should provide you the help you need to find those hidden files.

Was this helpful? Yes | No

How does this virus work on my computer and how to change the attribute to resolve this issue?

Last week, my Pen Drive was affected by a virus, its action is like make all the folder shortcuts. I went to safe mode and removed the virus from the pen drive but it made all folders hidden.

In order to find these hidden files, you need to plug in your Pen Drive and begin following the steps above in the how-to guide. Once you get to the step in which you have to type in the drive letter, you will need to type in the letter that represents your pen drive. Then continue on with the how-to guide.

Was this helpful? Yes | No

Hi, just a quick question?

I've never been on this site before, do I have to pay for it?....

No, this is free of charge site. Please feel free to ask.

If you have problems with any of the steps in this article, please post in the comments section below.

Comments

VisiHow welcomes all comments. If you do not want to be anonymous, register or log in. It is free.

Article Info

Categories : Antivirus

Recent edits by: Cerys 23, mgnonna, parthi

Share this Article:

Thanks to all authors for creating a page that has been read 40,798 times.