There are Two Methods to Lock a folder using .bat file.
1st Method :
1.Copy the below code and paste the code in your notepad and save the file as "lock.bat"
2.Click on "lock.bat",. and enter the password as "vidyarthiplus.com" .. Now locker will be open and it will automatically create a folder for u, Now put all your files which need to be locked.
3. Now again click "lock.bat", your folder will be locked..
To change password :"
The default password is "vidyarthiplus.com" , to change the pass, search "vidyarthiplus.com" in the below code and put your password.
Code:
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 u 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%==vidyarthiplus.com 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
2nd Method:
1.Create a new folder with name "lockfolder" and put all your files which need to be locked.
2.Copy and Paste the below code and save it as "lock.bat" and put the file in directory where the lockfolder is present.
Code:
ren lockfolder "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
3.To unlock the folder, copy the below code in "lock.bat" and put it in the directory where the lockfolder is present.
Code:
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" lockfolder
Done..