Forum Discussion
GodANarcissist
Jul 28, 2025Iron Contributor
How can I lock a folder in windows 10 with password for restricted access
Folks, So, I've got some files I want to keep private, and I need a way to lock a folder in Windows 10. I know there's no built-in 'password protect'option (thanks, Microsoft), but I heard mixed thi...
TwincehsokaAarmau
Jul 28, 2025Iron Contributor
If you're looking for a quick, no-software solution to put a password a folder in Windows 10, this method uses a simple batch script to hide and lock your files. Unlike encryption tools, this approach doesn’t actually encrypt the data but instead makes the folder invisible and inaccessible without the correct password.
How to lock a folder with password in windows 10
1. The script creates a hidden, system-protected folder that disappears when locked.
2. To access your files, you must run the script again and enter the correct password.
While not as secure as encryption, this method is useful for deterring casual users from accessing your files.
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