HOW TO LOCK AND UNLOCK THE FOLDER IN WINDOWS USING COMMAND PROMPT 

HOW TO LOCK AND UNLOCK THE FOLDER IN WINDOWS USING COMMAND PROMPT 

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

  1. cls
  2.  @ECHO OFF
  3.  title Folder Secure
  4.  if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto UNLOCK
  5.  if NOT EXIST Secure goto MDLOCKER
  6.  :CONFIRM
  7.  echo Are you sure you want to lock the folder(Y/N)
  8.  set/p “cho=>”
  9.  if %cho%==Y goto LOCK
  10.  if %cho%==y goto LOCK
  11.  if %cho%==n goto END
  12.  if %cho%==N goto END
  13.  echo Invalid choice.
  14.  goto CONFIRM
  15.  :LOCK
  16.  ren Secure “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
  17.  attrib +h +s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
  18.  echo Folder locked
  19.  goto End
  20.  :UNLOCK
  21.  echo Enter the Password to unlock folder
  22.  set/p “pass=>”
  23.  if NOT %pass%== password goto FAIL
  24.  attrib -h -s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
  25.  ren “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” Secure
  26.  echo Folder Unlocked successfully
  27.  goto End
  28.  :FAIL
  29.  echo Invalid password
  30.  goto end
  31.  :MDLOCKER
  32.  md Secure
  33.  echo Secure created successfully
  34.  goto End
  35.  :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. 

Leave a comment