How to Give a Password to a File or Folder in CMD without Using Any Software

There may be things on a computer that are sensitive that people should not see. Most people can find things just by snooping around if they have general knowledge of computers. Having a password-protected folder will work wonders against people and keep documents and files safe from prying eyes.

Locking a Folder

Step

Open up notepad and paste the following code into it.

Step

ls @ECHO OFF echo // Check1 (In Main Function) title Folder LockFolder if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLockFolder if NOT EXIST LockFolder goto MDLockFolder :AuthConfirm echo Are you sure u want to Lock Folder (Y/N) set/p "cho=>" if %cho%==Y goto LockFolder if %cho%==y goto LockFolder if %cho%==n goto END if %cho%==N goto END echo Invalid choice. goto AuthConfirm :LockFolder ren LockFolder "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" echo Folder LockFolder Locked! goto End :UNLockFolder echo Enter password to Unlock Folder set/p "pass=>" if NOT %pass%==TYPE YOUR PASSWORD HERE goto FailUnlock attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" LockFolder echo Folder UnLocked successfully! goto End :FailUnlock echo Invalid password! echo Try again? (Y/N) set/p "choice=>" if %choice%==Y goto UNLockFolder if %choice%==y goto UNLockFolder if %choice%==N goto END if %choice%==n goto END :MDLockFolder echo // Check2 (In MD Dir Function) md LockFolder echo Folder LockFolder created successfully! goto End :End

Step

Put the password where it says "TYPE YOUR PASSWORD HERE."

Step

Save the file as locker.bat by clicking "File," "Save As," and at the bottom, where it says .txt, change to "All Files."

Step

Open locker.bat and enter your password. It will create a new folder that will be password-protected from now on.