There are a few methods to lock a folder on Windows without using any software. Here are a few methods:
Method 1: Password-protect the folder using a batch file
- Open Notepad.
- Copy and paste the following code into Notepad:
@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 this folder? (Y/N) set/p "choice=>" if %choice%==Y goto LOCK if %choice%==y goto LOCK if %choice%==n goto END if %choice%==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
- Replace "yourpasswordhere" in the code with your desired password.
- Save the file with a .bat extension, such as "folderlock.bat".
- Double-click the batch file to run it.
- Type "Y" and press Enter to lock the folder.
- The folder will now be hidden and inaccessible without the password. To unlock the folder, run the batch file again, type the password, and press Enter.
Method 2: Hide the folder using the attrib command
- Open Command Prompt by typing "cmd" in the search bar and selecting "Command Prompt" from the results.
- Navigate to the directory containing the folder you want to hide by using the "cd" command.
- Type "attrib +h +s [folder name]" without the quotes, replacing "[folder name]" with the actual name of the folder.
- Press Enter to execute the command.
- The folder will now be hidden and inaccessible without the password. To unhide the folder, repeat the steps but replace the "+" with a "-" in the command.
Tags:
tools