Tutorial Thursday

One of the things that I’ve always done on my Windows computers is have them show all of the hidden files. Some people think I’m crazy because this adds a lot more clutter, but it always seemed as though I frequently had to access files there were otherwise hidden. Sure I liked when some files were out-of-sight because I only ever mess with a handful of them, but the hassle of going into the Windows Explorer options every time I needed to see some hidden files just wasn’t worth it.

After a little research I had come across an article on the PCWorld forum that outlined how I could create a shortcut that would enable or disable hidden files on the fly. If the setting is enabled it would disable it when run, and vice versa. It’s one shortcut that serves as an on/off switch for hidden files. Here’s how you do it:

  1. Open up Notepad and paste in the following text:
    Set sh = CreateObject("WScript.Shell")
    theKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden"
    setHidden = sh.RegRead(theKey)
    If setHidden = 1 Then
    setHidden = 0
    MsgBox "System and hidden files will no longer appear in Explorer.",64,"Hidden File Exchange"
    setHidden = 1
    MsgBox "System and hidden files will appear in Explorer.",64,"Hidden File Exchange"
    End If
    sh.RegWrite theKey,setHidden,"REG_DWORD"
    Set sh = Nothing
  2. Save the file with any name you want, but make sure to designate the extension to be “.vbs”:
    notepad vbs.jpg
  3. Run the file that you just saved. Give it a few seconds to take affect, but you should see the results without even having to restart Windows Explorer.
  4. If you want you can place this script file anywhere you’d like on your computer, and then you can create a shortcut to it by right-clicking on the file. I recommend placing a shortcut to the file in the Windows Explorer Favorites for fast access from the Favorites menu.

Compatibility: I’ve verified that this works on Windows XP, but it only works on Vista when User Account Control (UAC) is disabled. This is because it needs access to the registry, and Vista doesn’t allow that unless it is run as an administrator. Since it is a VBS file the “Run as Administrator” option does not appear when right-clicking on the file.

By default the script will prompt you with the current setting for the hidden files each time you run the script. That way you know whether you are turning them on or off. If you don’t want to see the prompts just remove the following two lines that I’ve highlighted in the code:

hidden files message box.jpg

Now you are all set with a shortcut that can enable or disable hidden files in Windows Explorer. This should help reduce the clutter you see on a regular basis by keeping the hidden files out-of-sight when they’re not needed, and then pulling them up when you need to make a change. How convenient is that?