Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My Windows 7 was recently infected by the virus and it hid all my files and directories. I believe I've removed the virus but I still can't find many files and programs.

Is there a single command-line tool in Windows that can recursively turn off the hidden attribute for an entire drive?

share|improve this question

migrated from Dec 10 '11 at 8:22

This question came from our site for system and network administrators.

If your computer has had a virus, the only truly safe thing to do is back up your files and apps and re-install your operating system from fresh media. – Joel Coehoorn Dec 10 '11 at 3:52
SuperUser already has "Computer is infected by a virus or a malware, what do I do now?", note. – JdeBP Dec 10 '11 at 12:28
up vote 1 down vote accepted

Unhide is designed specifically to address this symptom.

When run, it will unhide (-H) all +H files on the fixed disks of your computer. It will not, though, unhide any files that also have the +S attribute.

Refer to the Removal Guide for System Fix for further information.

share|improve this answer

I think attrib -H /S /D should do the trick.

share|improve this answer

You may also try this simple windows script for unhiding files and directories. It only prompts the user to input the drive letter then executes the vbscript.

Run your notepad, copy the code below, then save it as unhide.vbs

pc_drive = InputBox("Input drive letter" & vbnewline & "example: E:\", "Drive","E:\")
ryt = Right(pc_drive,2)
   If Len(pc_drive) <> 3 or ryt <> ":\" Then
   Call MsgBox("Either your input was invalid or the drive you specified doesn'texist",vbokonly,"Error")
End If

Set FSO = CreateObject("Scripting.FileSystemObject")
ShowSubfolders FSO.GetFolder(pc_drive)

Sub ShowSubFolders(Folder)
   str =""
   For Each Subfolder in Folder.SubFolders
      str =str & " " & Subfolder.Path
      subFolder.Attributes = 0
      ShowSubFolders Subfolder
End Sub

You could save it in your USB drive for more accessibility. Instruction how to use it can be found in the link below.

Windows Script For Unhiding Folders Hidden By Worm Virus

EDIT: provided the vbscript code.

share|improve this answer
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Sathya Jul 23 '12 at 7:28
I just edited my answer. I appreciate your suggestion. – Mr. Xymon Jul 24 '12 at 8:16
Thanks for taking the time and adding the content. The reason we ask to do this is to prevent content loss due to link rot. Cheers. – Sathya Jul 24 '12 at 8:23

I had the same problem and I found a solution on Stackoverflow (you can take a look at ).

This code will make visible only the directories.

So, create a BAT file ( open the Notepad, copy + paste the below code and rename the file to fix.bat) which will contains:

echo "Enter Drive letter" 
set /p driveletter=

attrib -s -h -a /s /d  %driveletter%:\*.*

Also, I modified a bit the code provided by Mr. Xymon to avoid make Recycled Bin visible and to avoid Windows Permission Error.

Here is the code:

Sub ShowSubFolders(CurrentFolder) 
  ' Skip some folders to avoid Windows Error Message
  If (CurrentFolder.Name <> "RECYCLER") and (CurrentFolder.Name <> "System Volume Information") and (CurrentFolder.Name <> "$RECYCLER.BIN") and (CurrentFolder.Name <> "Config.Msi") Then
    For Each Subfolder in CurrentFolder.Subfolders
      If (Subfolder.Name <> "RECYCLER") and (Subfolder.Name <> "System Volume Information") and (Subfolder.Name <> "$RECYCLER.BIN") and (Subfolder.Name <> "Config.Msi") Then
        Subfolder.Attributes = Subfolder.Attributes AND 0
      End If
  End If
End Sub

' Main program
pc_drive = InputBox("Input drive letter." & vbnewline & vbnewline & "Example: G:\", "Drive","G:\")
ryt = Right(pc_drive,2)
If Len(pc_drive) = 3 or ryt = ":\" Then

  Set FSO = CreateObject("Scripting.FileSystemObject")

  ' Check if the path exists or if the drive is ready
  If FSO.FolderExists(pc_drive) Then
    Call MsgBox("Our script will start after you click OK. Please wait the Finish Message!!!",vbokonly,"Starting...")
    ' TO DO: Add a progress bar here
    Call MsgBox("Done!",vbokonly,"Finished")
    Call MsgBox("Either your input was invalid or the drive you specified doesn't exist.",vbokonly,"Error")
  End If

End If


share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .