Have you ever encountered a worm virus that infected your USB drive and hid all your directories making you think that your files are gone forever? That happens to my students very often. A way to solve this is to open Folder Options from Tools menu (if you’re using XP) then enable Show hidden files and folders, but sometimes that’s not enough because the folder’s System attribute was set to True. By default, windows won’t show protected operating system files.
In my first blog, I discussed a way on how to unhide folders, hidden by a worm virus, by removing file/directory attributes using MS-DOS command attrib. The disadvantage of using this method is that it also affects all files in current directory including subdirectories, so the more files stored in your removable drive, the longer it takes to process.
So if we want to unhide directories much faster, we may resort to VBScript. VBScript can be used for Windows scripting and could be thought of as replacement for MS-DOS batch file (.BAT).
So here’s the VBScript code that would solve the problem. If you’re a Visual Basic programmer with experience using the FileSystemObject, you could easily figure out how it works.
You can copy-paste it on a notepad and save it with an extension name of .VBS or you just simply download unhide.vbs. You can save it in your USB drive for easier access.
How to use it:
1. Sometimes it doesn’t work by just double-clicking the file. So just to be sure, right-click the .VBS file then click Open with Command Prompt.
2. The script should ask you to input a drive letter. The default value is E:\ but you can change it depending on the drive letter assigned to your removable storage.
3. Upon clicking OK or just pressing Enter key, the script should do the rest of the job – unhide all hidden directories/folders including subfolders.
Use this script at your own risk. I will not be liable to any damage it may cause you. I only tested this on Windows XP.
You might encounter a runtime error message like the one shown below. The most likely reason of this error is a read-only permission. It’s a runtime error so there’s no problem with the syntax of the script.
Posted July 1, 2012
by Mr. Xymon