“Hacking” Portable Drives and Folders

So my cousin left me an old laptop and wanted me to copy the files off of it onto a removable hard drive. Since it is still in my custody after two weeks, I decided to have some fun. I “Cookie Monstered” her drive.


I didn’t just put stickers on it, I programmed it so that the icons of the folders on the drives are cookies, the icon of the drive itself is the cookie monster, and the name of the driver is “Cookie Monster.”


How is this possible???????


Well, Microsoft has secret files on your computer called “hidden files.” There are super secret files that are “Hidden systems files.” To such files are “desktop.ini” and “autorun.inf.” The first one controls, among other things, the appearance of folder icons. The second controls the appearance and function of removable media.

Let’s start with changing the icon of a folder.

Folders can have one or multiple of the following properties:

Read-Only: This makes the folder’s contents read-only (i.e. you can open the files it contains, but you cannot edit them).

System: This marks the folder as a System folder. This means it’s important to the operating system and effects how it displays.

Hidden: this means the folder is hidden.

Files and folders that are marked as both ‘Hidden’ and ‘System’ are nearly invisible. Hidden system files and folders are typically operating-system critical, so you don’t want just any old person coming in and fussing with them because it could result in a catastrophe.

System folders that are not hidden are folders like “My Pictures,”  “Documents,” “Music,” etc. You may have noticed that these folders have their own slightly different icons. It is possible to create your own folders like these. All you need is a text editor and an icon* (.ico) image and you’re good to go.

First of all, create your folder. I suggest using command prompt, because you will need command prompt to change the folder settings.

Follow the following steps:

    1. From command prompt, navigate to the directory where you want to create the folder (if you don’t know what command prompt is, go to the start menu and look for it, I am not here to teach you how to Google stuff). You can do this with the CD command.
    2. Use the mkdir command to create a new folder.
    3. Type attrib nameOfFolder +s to change the folder to a system folder.
    4. Open the folder in Windows Explorer by typing start %cd% (don’t close command prompt yet, you will need it again).
    5. Right-click in the folder and create a new text document. Rename it to “desktop.ini”** and add the following lines:

      The first line of the file is a command for Windows Explorer.
      The second line is the name of the icon file that you want to be the icon for the folder.
      The third line is an index into the icon file. Unless you are doing something fancy, this should always be 0. Close the text editor, you’re done typing.
    6. You should now place your icon named “icon.ico” into the folder.
    7. Bring up command prompt and use it to hide you’re newly added files by typing the following:
      attrib +s +h desktop.ini
      attrib +s +h icon.ico

these lines mark desktop.ini and icon.ico as operating system files and you should no longer see them if you navigate back to Windows Explorer. If you move up a directory in Windows Explorer you will now see your folder with a different icon, and the stuff inside it that makes the magic happen will be completely hidden.***

Here is an example of cookie folders:




The process for making this happen on a drive is slightly different. Go grab a portable drive, thumb drive, USB stick or whatever the kids are calling them these days and plug it in. I’ll wait.

Cool. If you open My Computer (or Computer) you should see your drive with something like E:\ Sandisk2.0 or something lame. There may even be a dorky icon that came with the drive. If this is the case, it will be addressed later****

Now we will take similar steps to modify the drive’s appearance.

  1. Open the drive and create a text file called “autorun.inf”
  2. add the following lines to the text file and save:
    label=Fancy USB
  3. Place icon.ico onto your drive.
  4. Open command prompt and use cd and attrib to make autorun.inf and icon.ico hidden system files.

Now, if you go to Computer, your flash drive should have the icon icon.ico and the name “Fancy USB” (or whatever else you like).

Continuing with my example:


Some background on autorun.inf: if you are of a certain age, you have probably played games that require a CD to run. When you insert the CD you may see a fancy icon and the name of the game show up in then “My Computer” instead of just “CD ROM.” The game may automatically start. All of this is because of the autorun.inf file on the CD. In our file the icon line indicates the path the icon is in, and the label line indicates what the drive should be called. You can read more about all that here. Portable drives behave slightly different than CDs, so you’re more limited in terms of what autorun can do.

You will likely want to play with this all a bit. Once you have for a while, you may want to automate the process using batch scripting.

Here, I created a batch script to do all the heavy lifting of creating cookie folders for me.


Did you encounter any problems? Here are a few tips, if they don’t answer your questions, please feel free to leave a comment and I will help you out.

Q:*Where do I get an icon (.ico) file?
A:There are two ways: simply use windows search and look for all icon files by typing “*.ico” in the search box (Click the picture to make it larger),


or create one using an editor such as paint.NET

Q:**When I try to rename my text file it doesn’t work right.
A: Windows has a pesky way of hiding file extensions. If your computer is doing this, go into options, (formerly “Folder Options”) and uncheck the box that says “Hide extensions for known file types.” Your life has just improved. (Click the picture to make it larger)


Q:***I want to see the hidden stuff, or I hid the files but I goofed and things aren’t working right, how do I see the hidden files?
A: You can use the attrib command to remove the system and hidden markers from the files. There are other ways, but this is by far the safest for a noob.

Q:****My drive already has an icon or I can’t seem to create a file called “autorun.inf” because it already exist but I can’t see it.

A:If you have an off the shelf USB stick, it may already have an “autorun.inf” file and an icon. You can once again use attrib in command prompt to change these files to regular files for editing. You can rest assured autorun.inf is in the root directory, so attrib -s -h autorun.inf will make it appear. You can then edit it, and find the icon and change the icon.



One thought on ““Hacking” Portable Drives and Folders”

Leave a Reply

Your email address will not be published. Required fields are marked *