Saturday, February 9, 2013

How to Lock a folder using a simple .Bat File


Most of the People are using third party application tools like "Folder Lock" to hide folders and files from unauthorized access. So today I'm going to show how to hide a folder or file using a .bat file . 
Solution:

Step 01

Create a Folder name call "Test".Open Notepad and Copy below code then save it with.bat extension .

cls
@ECHO OFF
title Folder Test 
if EXIST "HTG Locker" goto UNLOCK
if NOT EXIST test 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 Test "HTG Locker"
attrib +h +s "HTG Locker"
echo Folder locked
goto End
:UNLOCK
echo Enter password to unlock folder
set/p "pass=>"
if NOT %pass%== Test123 goto FAIL 
attrib -h -s "HTG Locker"
ren "HTG Locker" Your Folder Name
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Test  
echo Test created successfully
goto End
:End

Step 02

Open the .bat file that you create. once you open file you will see a window like below


To lock the folder press "Y" and Enter. Now you can't see the Test folder that created.

Step 03

To unlock the folder open the .bat > type the password. Now you can see the folder that you created on the desktop.



Enjoy!!!


0 comments:

Post a Comment

  • Page Views

  • More Text