Author: Trey Williams
Saturday, November 30, 2019

Password Protecting Folders and Files

Category: Security

If you share a computer login, it might be in your best interest to use a password to keep private files safe from prying eyes. Of course, this won't protect you from malware or online security breaches, but it is an easy way to safeguard your private information.

As a rule of thumb, passwords are case-sensitive, and a strong password includes upper case and lower letters, at least one number, and (for technical reasons) no spaces. Therefore, it's important to ensure you pick a password that is secure but also memorable. There's usually no way of resetting the password for a protected file, so any information within that file will be lost forever if you forget your credentials. 

Protecting Folders in Windows (All Versions)

This handy trick can be used in multiple locations across your hard drive to hide and lock multiple different folders. It should work with all versions of Windows. 

  1. Create a new text document (in notepad). It can be located wherever you like - in My Documents or on the Desktop - but we recommend using the right-click menu to create it. Right-click, select New, and then Text Document.

  2. Open the text document, then copy and paste the following within:


if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK

if NOT EXIST Private goto MDPrivate


echo Are you sure to lock this folder? (Y/N)

set/p "cho=>"

if %cho%==Y goto LOCK

if %cho%==y goto LOCK

if %cho%==n goto END

if %cho%==N goto END

echo Invalid choice.



ren Private "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"

attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"

echo Folder locked

goto End


echo Enter password to Unlock Your Secure Folder

set/p "pass=>"

if NOT %pass%== gurusolutions FAIL

attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"

ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private

echo Folder Unlocked successfully

goto End


echo Invalid password

goto end


md Private

echo Private created successfully

goto End


  1. In this code, the default name of the folder is Private, and the password is guru solutions. They're in bold and underlined in the code, so you can find and adjust such details as you see fit.

  2. You now need to save the text file. You can choose whatever name you like, as long as you end it with .bat, and change the selected option in the drop-down to All files before hitting Save. This turns the notepad into a batch file and provides the mechanism for locking the folder.

    {screen shot}

  3. If you double-click on the batch (text) file, a new folder with the name you specified in the code (Private, in our example) will appear. Add whatever files you want to protect to this folder.

  4. Once you've finished and you're ready to lock the folder, double click the batch (notepad) file again. A window will open, asking the question: “are you sure you want to lock this folder (Y/N).” Type Y and hit Enter.


  1. This will cause the Private folder (or whatever you named it in step 3) to disappear.

  2. Whenever you want to get into the folder, double-click on the batch (notepad) file again. Enter your password, hit enter, and the folder will reappear.

  3. To hide the file again, the process is the same as in step 6.

You can have as many batch files as you like at various points on your hard drive, but make sure you name each of them differently (step 4) and choose a password you won't forget. It won't be possible to get into any of your locked folders if you forget the credentials.

Protecting Folders in Windows 10 Pro

Users of Windows 10 Professional edition have the option of creating a virtual hard drive that can be treated like a normal folder for hiding all your private files. You can then encrypt this drive and add a password using BitLocker. BitLocker is a complete encryption solution provided by Microsoft for Windows 10 Pro, but it's not available with the Windows 10 Home edition.

Protecting Folders in macOS

While there are various third-party solutions to protecting your personal folders, this method turns a folder into a lockable disk image file without the need for any additional software. It's a free, straightforward process applicable to all macOS versions since OS X 10.6 Snow Leopard.

  1. Open Applications by hitting Command + Shift + A.

  2. Open the Utility folder and then Disk Utility.

  3. Select File from the main menu and click Select New Image.

  4. Choose Select Image from Folder to locate the folder you want to protect. Could you select it and click Open?

  5. In the Image Format Options menu, choose read/to write.

  6. From the Encryption menu, select 128-bit AES encryption and then enter your password of choice.

  7. Type in your password a second time and hit Choose.

  8. The final step is to name and save the image you just created. You're done!

  9. You can add the files you want to keep private to this disk image, just like you would with a normal folder. You can even delete the original folder, too, if you like.

Microsoft Office Files

Adding a password to Word, Excel, and PowerPoint files is very straightforward. The steps below should work regardless of your operating system or the version of Microsoft Office that you're using. 

  1. Open the Microsoft Office file you want to protect.

  2. Choose File from the Main Menu and then select Info from the drop-down menu.

  3. In the Info pane, click Protect Document and then choose Encrypt with Password.

  4. Enter your password of choice, click OK, and then type your password a second time.

  5. Clicking OK again will save your changes, and you'll be prompted to enter a password the next time you try to open the file.

  6. To remove the password from a protected file, the process is much the same. First, choose File, Info, and then Protect Document. Next, select Encrypt with Password to bring up the dialog box with your password. Finally, delete the password and click OK to save the changes.

Open Office Files

In Open Office, you can choose to add a password to your files when you Save As.

  1. After naming your file, tick the box to Save with Password and click Save.
  2. Enter your password of choice into the prompt window, confirm it, and click OK to save your changes.

Google Drive Files

On the face of it, Google Drive is the perfect place to store documents and anything containing sensitive information because it's tucked safely away in the cloud and can't be accessed until you sign into Google. The problem is that, as it's more convenient for most people to stay logged into Google, anybody with access to your device also has access to your private files. 

Unfortunately, Google Drive doesn't have the functionality to individually protect and request a password for each of your files. There are ways to achieve a similar response, but they require some initial legwork and technical understanding. For this reason, a password-protected app might be a better plan. In addition, many of the apps available will support spreadsheets, notes, and documents with full formatting options.

Android Files

It's also possible to lock the files and folders on your Android smartphone or tablet using a password. And, as you might expect, there's an app for that. Check reviews and individual specifications before downloading anything to make sure you're choosing an app that can provide the functionality you need. Paying for an app doesn't necessarily guarantee quality. 

Most of these apps will work in the same way. They act as a file manager through which you select and move the files of your choice into one big secure folder within the app. You can then only access this folder via the app after entering the correct password. Some apps will go a step further and hide away from your home screen, and some will include functionality to password protect access to other individual apps. The full range of files you can hide, lock and protect will depend on the app itself. 

USB Drives

A removable USB memory stick is already a fairly secure way of storing the information you want to keep private but adding a password provides an extra level of protection. Windows provides various tools, or apps, that enable you to do this. Options include Rohos Mini Drive, SafeHouse Explorer, and VeraCrypt, amongst others. Each offers different features, such as two-step authentication or 256-bit encryption, and most are free to download. Choose the tool which best suits your needs and follow the on-screen instructions.

If you're a Mac user, you don't need to download any additional software as the functionality to encrypt USB drives has been available in the Finder utility since the release of Mojave (10.14).

  1. Before it can be encrypted, your USB drive must be formatted as GUID Partition Map. If you need to do this, copy the drive's contents onto your hard disk (temporarily) and then use Disk Utility to clear and reformat the drive. Then, choose Scheme from the pop-up menu and then GUID Partition Map.

  2. Open Finder and right-click on the icon for the USB drive, then choose Encrypt.

  3. Enter a strong password of your choice and then verify it.

  4. Click Encrypt Disk to complete the process.

Flash Drives and Memory Cards

Adding extra protection to a flash drive or Solid-State Disk (SSD) memory card is essentially the same process as above for both Windows and macOS. If your device doesn't include an in-built card reader, you'll need to use a USB reader instead. Your computer will treat the flash drive in the same way it does any other external storage device, and you can use the same steps outlined above to add password protection.

Be aware that if you'll no longer be able to use the same memory card or flash drive in any other device, such as your camera, once it's been encrypted.


Depending on what device and operating system you're using, there are various ways to password protect and/or encrypt the files you want to keep private.

MS Office makes it really easy to add a password to Word, Excel, and PowerPoint files with just a few clicks of the mouse, regardless of your OS. Add and confirm your password of choice in the Protect Document pane from the File options in the main menu. 

Open Office, the free alternative to MS Office, makes adding a password as easy as checking a box when you choose to Save As.

If you want to protect information not stored as MS Office files and you're a Windows user, you can do this by adding specific code instructions to a notepad and saving it as a batch file. This allows you to add private files to a folder which is then hidden from sight.

In macOS, you have in-built functionality to protect your private folders in Disk Utility. The process involves saving the folder in question as a disk image before adding encryption and a password.

Windows users who want to password protect and encrypt removable drives, like a USB memory stick or an SSD memory card, will need to download free third-party software. macOS users have this option built-in and, since Mojave 10.14, can Encrypt Disk from within the Finder utility.

You can find many applications in the Apple and Google Play stores, which allow you to hide, lock, and password-protect files on your smartphone or tablet. Be sure to read user reviews and individual specification details before downloading the app that best suits your needs. 

Even though Google Drive itself is secure, there's no option to password protect individual files. So a third-party app might be the best solution for you here, too.

Creator Profile
Joined: 10/2/2019

ver: 20231031T141653