• Skip to main content
  • Skip to primary sidebar

Master Your Tech

Mobile phones, software, consumer electronic how-to guides

  • iPhone
  • Excel
  • Powerpoint
  • Word
  • Google Drive
  • Tech
  • Guides
You are here: Home / Guides / How to Lock Folders on Windows 10: A Step-by-Step Guide

How to Lock Folders on Windows 10: A Step-by-Step Guide

posted on January 23, 2026

Locking Folders on Windows 10

If you’re looking to keep certain files away from prying eyes, locking folders on Windows 10 is a great way to add an extra layer of security. This process involves creating a locked folder that requires a password to access. With just a few steps, you can ensure your sensitive files remain private. Ready to become a file-locking pro? Let’s dive in.

How to Lock Folders on Windows 10

To lock a folder on Windows 10, you’ll be creating a batch file that will allow you to hide and secure your files with a password. Here’s how you can do it:

Step 1: Create a New Folder

First, create a new folder where you want to store your locked files.

Right-click on your desktop or in File Explorer, select ‘New’, and then choose ‘Folder’. Name this folder something memorable.

Step 2: Open Notepad

Open Notepad to create a batch file that will manage the locking process.

Click on the Start menu, type ‘Notepad’, and hit Enter to open it. This simple text editor will be your go-to tool for creating the lock mechanism.

Step 3: Write the Batch File Code

Copy the sample code into Notepad, replacing ‘YourPasswordHere’ with your desired password.

Here’s the code you need:

cls
@ECHO OFF
title Folder Locker
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Locker goto MDLOCKER
:CONFIRM
echo Are you sure you want to lock the 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.
goto CONFIRM
:LOCK
ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto End
:UNLOCK
echo Enter password to unlock folder
set/p "pass=>"
if NOT %pass%==YourPasswordHere goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Locker
echo Locker created successfully
goto End
:End

Make sure you update the password section to something secure but memorable.

Step 4: Save the File as a Batch File

Save the Notepad file as a .bat file in the folder you created earlier.

Click ‘File’, then ‘Save As’. Choose ‘All Files’ under ‘Save as type’, and name your file ‘Lock.bat’.

Step 5: Execute the Batch File

By double-clicking the ‘Lock.bat’ file, you can lock or unlock your folder.

Run the batch file, and it will either lock the folder or prompt you for a password to unlock it.

After completing these steps, your folder should be securely locked. Whenever you want to access your files, just run the batch file and enter your password.

Tips for Locking Folders on Windows 10

  • Always remember your password. If you forget it, accessing your files can become difficult.
  • Regularly back up important files. Locked folders can sometimes become inaccessible if something goes wrong.
  • Use a complex but memorable password to enhance security.
  • Consider using encryption software for highly sensitive data.
  • Test the locking mechanism with non-essential files first to ensure it works correctly.

Frequently Asked Questions

Can I lock multiple folders?

Yes, you can create separate batch files for each folder you want to lock.

What if I forget my password?

Unfortunately, without the password, accessing your files could be challenging. Make sure to write it down somewhere safe.

Is this method completely secure?

While effective for basic privacy, more advanced users might bypass it. Consider encryption for sensitive data.

Can I share the locked folder with others?

Others will need the password to access the contents, so share it carefully.

Will Windows updates affect my locked folders?

Generally, no. But always keep a backup just in case an update causes issues.

Summary

  1. Create a new folder.
  2. Open Notepad.
  3. Write the batch file code.
  4. Save as a .bat file.
  5. Execute the batch file.

Conclusion

Locking folders on Windows 10 is a straightforward way to add an extra layer of security to your files. By following these steps, you can decide who gets to peek into your digital treasure chest. Whether it’s work documents, personal photos, or other sensitive data, having control over accessibility is like having a secret key to a hidden room in your house.

Remember, while this method is convenient and quick, it’s not completely foolproof. For highly sensitive information, consider using encryption software or cloud services that offer robust security features. Always back up critical data to avoid losing access due to unforeseen circumstances.

Happy file-guarding! If you’re keen on further enhancing your digital security skills, why not explore other options like two-factor authentication and secure cloud storage? Your files deserve the best protection!

Matthew Burleigh
Matthew Burleigh

Matthew Burleigh has been a freelance writer since the early 2000s. You can find his writing all over the Web, where his content has collectively been read millions of times.

Matthew received his Master’s degree in Computer Science, then spent over a decade as an IT consultant for small businesses before focusing on writing and website creation.

The topics he covers for MasterYourTech.com include iPhones, Microsoft Office, and Google Apps.

You can read his full bio here.

Share this:

  • Click to share on X (Opens in new window) X
  • Click to share on Facebook (Opens in new window) Facebook

Related posts:

  • How to Lock Folders on Windows: Easy Steps to Secure Your Data
  • How to Personalize Start Folders in Windows 11: A Step-by-Step Guide
  • How to Show Hidden Folders in Windows 10: A Step-by-Step Guide
  • How to Show Hidden Folders in Windows 11: A Step-by-Step Guide
  • How to View Hidden Folders in Windows 10: A Step-by-Step Guide
  • How to Hide Folders on Windows 10: A Step-by-Step Guide
  • iOS 17: Rename Folders on Your iPhone with Ease – A Step-by-Step Guide
  • How to Make Photo Folders in iOS 17: A Step-by-Step Guide
  • How to Create Folders in Gmail: A Step-by-Step Guide
  • Creating Folders in Yahoo Mail: Organize Your Inbox with Ease
  • How to Turn Off FN Lock in Windows 11: A Step-by-Step Guide
  • How to Change the Lock Screen on Windows 11: A Step-by-Step Guide

Filed Under: Guides

Search

Primary Sidebar

Latest Posts

  • How to Restore Windows 11: A Step-by-Step Recovery Guide
  • How to Uninstall Latest Windows Update: A Step-by-Step Guide
  • How to Connect Bluetooth Headphones to Windows 10: A Simple Guide
  • How to Fit PC Screen to TV on Windows 10: A Step-by-Step Guide
  • How to Stop Windows from Automatically Updating: A Simple Guide
  • Contact Us
  • Privacy Policy
  • Terms and Conditions

Copyright © 2026 MasterYourTech.com