How To Lock A Folder In Windows 10

Do you have sensitive or private files on your Windows 10 PC that you want to protect from unauthorized access? One of the best ways to do this is to lock a folder containing your important files. In this blog post, we will guide you through the process of locking a folder in Windows 10 to ensure your data remains safe and secure.

Method 1: Using a Batch File

In this method, we’ll create a simple batch file that will lock and unlock your folder. Follow these steps:

  1. Right-click on your desktop or inside the folder where you want the locked folder to be created. Select New and then Text Document.
  2. Open the new text document and paste the following code:
    title Folder Locker
    if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto UNLOCK
    if NOT EXIST Locker goto MDLOCKER
    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
    ren Locker “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 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
    echo Invalid password
    goto end
    md Locker
    echo Locker created successfully
    goto End
  3. Replace YourPassword in the code with your desired password.
  4. Click on File in the top left corner, then click Save As.
  5. Change the ‘Save as type’ to All Files. Name the file ‘FolderLocker.bat’ and click Save.
  6. Double-click the FolderLocker.bat file to create the Locker folder.
  7. Move all the files you want to protect into the Locker folder.
  8. Double-click the FolderLocker.bat file again and type ‘Y’ to lock the folder. The folder will now be hidden and locked.
  9. To unlock the folder, double-click the FolderLocker.bat file once more and enter your password.

Method 2: Using a Third-Party Software

If you prefer a more user-friendly option, you can use third-party software to lock your folders easily. A popular choice is Folder Lock, which offers various features including folder locking, file encryption, and file shredding. To use Folder Lock, follow these steps:

  1. Download and install Folder Lock from their official website.
  2. Launch the software and set up a master password.
  3. Click on the Lock Folders option in the main menu.
  4. Click on the Add button and browse for the folder you want to lock. Select the folder and click OK.
  5. Your folder will now be locked and hidden. To unlock, simply select the folder in Folder Lock and click Uninstall.


Now you know two effective methods to lock a folder in Windows 10. Whether you prefer using a simple batch file or third-party software, you can easily protect your sensitive files from unauthorized access. Remember to keep your password safe and secure to ensure the best protection for your data.