How to Lock the Folder in Windows 10: A Step-by-Step Guide

Locking a folder in Windows 10 is a great way to keep your files safe from prying eyes. Here’s how you can do it quickly and easily: First, you’ll create a new text document with specific code. Then, you’ll save it as a batch file. Running this file will create a locked folder where you can store your files securely. To unlock the folder, you simply run the batch file again and input your password.

How to Lock a Folder in Windows 10

In this section, you’ll learn how to create a locked folder in Windows 10 using a simple batch script. By following these steps, you’ll ensure your personal files are protected.

Step 1: Create a New Text Document

Open Notepad.

Notepad is a simple text editor that comes pre-installed on Windows 10. You can find it by typing "Notepad" in the search bar and clicking on the app icon.

Step 2: Copy and Paste Code

Copy and paste the following code into the Notepad:

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%== yourpassword 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

Replace "yourpassword" with your desired password.

Step 3: Save as Batch File

Save the file as "FolderLocker.bat".

When saving, make sure to select "All Files" in the "Save as type" dropdown menu, and add ".bat" at the end of the file name.

Step 4: Run the Batch File

Double-click the "FolderLocker.bat" file.

This will create a new folder named "Locker" in the same location as the batch file.

Step 5: Store Files in the Locker Folder

Move your files into the "Locker" folder.

This is where you’ll keep all the files you want to protect.

Step 6: Lock the Folder

Double-click the "FolderLocker.bat" file again.

Follow the on-screen instructions to lock the folder. The "Locker" folder will disappear.

Step 7: Unlock the Folder

Double-click the "FolderLocker.bat" file and enter your password.

The "Locker" folder will reappear with your files intact.

Once you complete these steps, your folder will be securely locked, and only accessible by re-running the batch file and entering the correct password.

Tips for Locking a Folder in Windows 10

  1. Backup Your Files: Always keep a backup of important files in case you forget your password or something goes wrong.
  2. Strong Password: Use a strong, memorable password to ensure your files are secure.
  3. File Location: Keep the batch file in a safe location so you can easily access it when needed.
  4. Batch File Name: Use a discreet name for your batch file to avoid drawing attention.
  5. Double-Check: Ensure there are no extra spaces or typos in your code to prevent errors.

Frequently Asked Questions

What if I forget my password?

Unfortunately, if you forget your password, there’s no easy way to recover it from the script. Always keep a backup of important files elsewhere.

Can I change the password later?

Yes, just open the batch file in Notepad, change the password in the script, and save it.

Will this method work on other versions of Windows?

It might work on older versions like Windows 7 or 8, but it’s primarily designed for Windows 10.

Is this method completely secure?

While it adds a layer of security, it’s not foolproof. For sensitive data, consider using dedicated encryption software.

Can I lock multiple folders?

You can create multiple batch files for different folders, each with its own password.

Summary

  1. Create a new text document.
  2. Copy and paste the provided code.
  3. Save as a batch file.
  4. Run the batch file.
  5. Store files in the "Locker" folder.
  6. Lock the folder by running the batch file again.
  7. Unlock the folder using your password.

Conclusion

Locking a folder in Windows 10 using a batch script is a handy and straightforward way to keep your personal files safe. With just a few steps, you can ensure that only you have access to your sensitive data. Remember to use a strong password and back up your important files to avoid any mishaps. This method is a good starting point for basic file security, but for more robust protection, you might want to explore other encryption tools available. So, go ahead and give it a try—secure your files and enjoy peace of mind!

Get Our Free Newsletter

How-to guides and tech deals

You may opt out at any time.
Read our Privacy Policy