Hi. Its Salman here .Today I will show you how to lock and unlock a folder using windows batch file programming. This will create a new folder,import the items into the folder created .Once you click the folder the folder get locked and disappeared. Here is the batch file program. Read the below steps carefully
- cls
- @ECHO OFF
- title Folder Secure
- if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto UNLOCK
- if NOT EXIST Secure 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 Secure “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 the Password to unlock folder
- set/p “pass=>”
- if NOT %pass%== password goto FAIL
- attrib -h -s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
- ren “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” Secure
- echo Folder Unlocked successfully
- goto End
- :FAIL
- echo Invalid password
- goto end
- :MDLOCKER
- md Secure
- echo Secure created successfully
- goto End
- :End
- Copy this code and save it with .bat extension .
- Once you click the batch file you will see the folder named secure .
- You should import the files you need hide to this folder.
- You can also change the name of the folder in replacing all the occurrence of Secure with the name you want.
- Initially the password to open the folder Secure password.
- You can change the password in line 23 by replacing password with password you want.
Thank you.
