Tip of the day: Show hidden files with a simple script

In its default settings, Windows Explorer conceals two types of files: those with the hidden attribute set, and those designated as system files. Some people, including my occasional writing partner Woody Leonhard, think you should always enable the display of hidden files. I don’t agree – in general, I prefer to keep system and hidden files hidden except when I need to solve a particular problem. To change Explorer’s settings so hidden and system files are visible, open any Explorer window and click Tools, Folder Options (or click the Folder Options icon in Control Panel). On the Folder Options dialog box, click the View tab and select the Show hidden files and folders checkbox. Then scroll down a bit further and clear the Hide protected operating system files (Recommended) checkbox. (You’ll have to click past a warning dialog box to make this change.) When you close the dialog box and return to the Explorer window, you’ll see all the files in that folder, including those marked as hidden and system files.

Show_hidden_files

It is annoying to make this change, and equally annoying to undo the change when you’re finished with the current task. So for Windows XP Inside Out, we came up with a script that automates the process. The script examines the registry to see whether hidden files (those with the Hidden attribute set) are displayed in Windows Explorer. If not, it modifies the registry so that hidden files and super-hidden files (those with the System and Hidden attributes set) are displayed. The script also assumes that you probably want the option to edit file name extensions, so it changes settings to make all file name extensions visible as well. If hidden files are already displayed, the script assumes you want to undo the previous set of changes and modifies these three registry values accordingly.

I’ve made the script file available for download in compressed (Zip) format: Click here to download the file, extract it to a convenient location, and run it whenever you want to toggle hidden files.

If you want to view the script contents first, click here to see the text in a separate browser window. Remember to save the script file with the .vbs extension.

When the script runs, it changes the current settings and displays the results in an information box. If the script won’t run properly on your computer, check to see whether your anti-virus or security software is blocking Visual Basic script files.

38 Responses to Tip of the day: Show hidden files with a simple script

  • This is too cool, and a very welcome script.

  • I think the issue isn’t so much with recommending that option to be on as it is with the implementation. Hidden files are about viewing the files not actual properties of a file. In file dialogs and file browsers, I should be able to create views of a folder to see what I want. Hidden files deal with viewing files not the file itself. The Microsoft implementation puts the hidden property on the file though.

  • Zimmy says:

    Nice. Exactly what I was looking for. I use an icon association program that drops a settings file in each folder including the desktop and it’s nice to hide those. Less clutter is better too.
    Thanks, rock on.

  • Dee says:

    This is really useful, but I need one which just disables super-hidden. How would I edit this to do that?

  • Ed Bott says:

    Dee,

    You should be able to accomplish what you’re looking for by deleting the line that begins with “IF” and then deleting the “ELSE” line and everything that follows it.

  • Yelinna says:

    THANKZZZ!!! Weeks ago the soraci.b infected my machine, I could clean it but the “Folder Options” button dissapeared, I tried to fix it with the windows registry and nothing happened, you save my life!! Now i can see the hidden files and (in the next infection) I’ll can clean my computer again.

    Thankz so muuuchhh!!!! :D :D :D :D :D

  • Kathy says:

    Hi everyone. I just finished copying all of my Office documents from my desktop to my new laptop. Unfortunately some folders/files are now showing up as “hidden” and the toggle to make then “unhidden” is whited out in the properties section. Anybody know of a way to fix this problem? It’s not critical but really annoying. Unfortunately those folders/files that have been tagged “hidden” show no pattern (and yes, I did go into windows property and click on “show all files” option). Thanks for help!

  • Ed Bott says:

    Kathy,

    If the files are in your My Documents folder, and you are comfortable with the command line, you could try this option. Click Start, Run. In the Open box, type cmd and then press Enter. This opens a command window. Log on to your My Documents folder so it is showing as the current path. (If necessary, type CD %userprofile% and then cd “My Documents” (be sure to include quotes).)Now type the following:

    attrib -h *.* /s

  • Kathy says:

    Hi Ed, thanks so much for your help; at least I’ve learned about the attrib function. I did what you said but for each of the problem folders it says “not resetting system file”. Recopying these folders from the source hasn’t fixed the problem either. Any other ideas?

    Kathy in Arlington, VA

  • Ed Bott says:

    Kathy, I wonder if this is a permissions issue. You might need to take ownership of all these files.

  • Dan Q says:

    That is because it is both system and hidden file. Use the command line and take off both at the same time will do the trick.

    attrib -h -s *.* /s

  • dbpvr says:

    ed bott was correct

    you need to take ownership of the Dir/files

    if you have simple file sharing enabled(xp default) you need to disable that in folder settings and then right click on the files/Dir security tab/advanced/owner
    choose either your user name or administrator.

  • dbpvr says:

    P.S. if they are all in one dir choose the dir to take ownership of (or create one) and do the same but make sure you check mark “Replace qwner on subcontainers[folders]and objects[files}” .This will act like a batch process on all dir and files in that folder ;)

  • CJ says:

    I alredy knew this, but im trying to view files in C:\system\recycler, how do i do this?

  • pykko says:

    hello!
    Your script works fine but I have a problem. I’ve used this script as my Folder Options under Tools is missing. :( How to put it back?

  • Ed Bott says:

    Pykko, I’m not sure. Lots of people seem to have experienced this problem and have some suggetions for you. Try this search.

  • Talldog9 says:

    Great job!

  • chris says:

    how would you modify this so that it didn’t display the dialog box? thanks, very useful :)

  • Ed Bott says:

    Chris, just take out the Wscript.echo sections to eliminate the dialog boxes.

  • Simon H says:

    Hi,
    I’ve tried this script, and it does change the values it is supposed to in the registry, but the change isnt reflected in explorer, not even after pressing F5, switching folders or restarting explorer. The change only comes into place if i go tools>folder options, select the view tab then click OK, then press F5. Any ideas how to get around this? I’m using XP x64 Pro if that helps.

    Thanks, Simon

Hosted by A2

A2 Hosting does PHP5, MySQL5, PostgreSQL 8, cPanel, Ruby on Rails, and SSH/Shell.
I use them because I like dealing with responsive, friendly human beings.
Plans from $2.95/month.
  • Congrats to @harrymccracken for his new editorial gig RT @gchiemingo TIME is on his side (too easy) 3 hours ago
  • Google-branded streaming media device coming http://t.co/eyTnRdNQ via @WSJ 3 hours ago
  • "As an in-depth engineering dialog, we tend to favor the long form for Building Windows 8 posts" 8,617 words on Windows on Arm 6 hours ago
  • Sinofsky: "WOA includes desktop versions of the new Microsoft Word, Excel, PowerPoint, and OneNote" 6 hours ago
  • Sinofsky: Windows on ARM (WOA) includes "if you wish, the Windows desktop w/ tools like Windows File Explorer and desktop Internet Explorer" 6 hours ago