How To: Hide Files on a USB Flash Drive

close up picture of flash drive

There are two methods to hide a file on a flash drive. Both methods are free and one is better than the other.

The first method is very straight forward and easy for anyone to use and probably common to most computer users. That said, this first method is also easy to detect the file on the USB.

The second method is more obfuscated and harder to detect. Using the second method it is harder to find the hidden file unless you are specifically looking for it.

Both methods work well for hiding a file on a flash drive and free to use with a Windows computer; however, anyone with a bit of IT knowledge and experience can find the files – so this isn’t a bullet proof method for hiding a file from absolutely everyone.

If you are looking for a truly secure method to hid a file on a USB flash drive then a paid-for-product will be your better solution, you might want to check out some Secure Flash Drives by this company.

But in the meantime, if you need a quick solution, or you don’t want to spend money on a product, today’s article will work fine.

Windows computers are set up to NOT show hidden files. The quickest way to hide a file on a USB flash drive is to right click the file and in Properties select “hidden”. You can also do this for a folder and all the contents inside the folder will also be hidden.

See the two images below.

First image is setting the Properties of the file. The second image is the result of the properties change on a Windows computer which does NOT see hidden files. Note, in the second image we can see the file listed in the Command Prompt… so the file is there!

properties of hidden file on USB flash drive

command line of hidden file on USB flash drive

If the User has “View hidden files and folders” to ON, this method doesn’t help.

show hidden files on USB flash drive

The second method to hide a file on a USB flash drive is more discrete and harder to detect. This version will not display the file when the User has “View hidden files and folders” turned On.

What we are going to do is create a “system hidden” file. The system hidden file setting is an elevated level of hiding. Windows hides a file flagged as a system hidden file so a none-technical User will not accidently delete a system file use in critical operations of the operating system or program.

We can use this system hidden file property to hide a file on a USB flash drive.

The easiest way to apply this property is to copy the file (or folder) to the USB stick and from the flash drive, we apply the setting through the command line. This is very easy to do.

In our example, we created a “text.txt” file and copied that file to the USB flash drive.

Once the file is on the USB flash drive, click into the File Explorer ribbon and type cmd and click Enter. This will open the command prompt to apply the change.

use command line to hide files on flash drive

At the command prompt we type a few characters to make the change so the file is system (+s) hidden (+h)


attrib +s +h D:\text.txt

Be sure to replace D:\text.txt with file path location and file name. Meaning, be sure to take note of the Drive Letter of your USB flash drive and the path to reach the individual file.

system hidden file property to hide file on a USB stick

By adding the attribute +s and +h the file becomes flagged as system hidden.

Be sure to type exit to exit out of the command prompt and power cycle the USB flash drive (disconnect, reconnect) and you will see the file has gone away.

To view the file, go back into the cmd prompt as mentioned earlier and type:

dir /a:h

and here you will see the first method (setting the properties as a hidden file) and the second method doesn’t list the file at all, but the Command Prompt does list the file being present on the USB flash drive.

Do you see the “text.txt” file listed in the Command Line?

view system hidden file on USB drive

As you can see this is a great way to hide a file on a USB flash drive which is fairly difficult for any user to find. The only way a User would see this system hidden file is if their “Hide protected operating system files (Recommended) is unchecked. This isn’t the case for 99.9% of the users because if a user has this setting on, they are really exposing themselves to potential problems by allowing these types of files to be seen and possible deleted.

The only item left is figuring out how to view or open the file. This can be done one of several ways.

  • The User can enable the “Hide protected operating system files” and when that is done the User will have the ability to view the file and then click and open it. However, this is a global setting and puts the operating system at a higher level of risk.
  • Going back into the command prompt the User can reverse the system hidden file properties. It’s very easy to do. Simply type: attrib -s -h D:\text.txt This is a nice method because it doesn’t expose your entire OS to system hidden files.
  • Another method is using the command line to call out the file in the program you want to open the file up with. This method will not change the system hidden file property, but will allow you to open the file. This method is also very easy to do in the command line. Type: notepad d:\text.txt and this will open our system hidden file “text.txt” in Notepad as the image below shows:

open hidden file on USB flash drive from command line

If the above two solutions are not secure enough, there is a “Secure Disk” solution which is a product that hides an entire partition from any user. Only have a specific password is entered the entire partition becomes viewable and accessible. This is a hardware controller based solution, so not a solution which can be hacked or reverse-engineered. Check the link mentioned earlier in the article if you need a very secure way to hide a file on a USB flash drive.

Was this article helpful?

Tags: , , , ,

Rich Gates

Administator for started in 2004 with the concept of providing USB information for everything USB related. At the time, USB was gaining momentum and every day new products, articles and news became published. Today, the site is focused on bringing technical information, tricks and hacks to USB related products. The site does publish off topic information as well, to keep the variety up. Please visit the footer area of any page if you or your company is interested in article or product placement via purchased advertising.

Copyright © 2006 +

USB Powered Gadgets and more...

All Rights Reserved

GetUSB Advertising

This is a high value website providing great exposure to your product and brand. Visit our advertising page to learn specifics.

For more information
Visit our advertising page.

Nexcopy Provides

USB copy protection with digital rights management for data loaded on USB flash drives.

Contact us learn more