How To Lock / Unlock Password Protected Folder Using BAT File

Have you ever wish you could lock and unlock folder so you could hide your important files without using folder properties? Now you could using BAT File. It’s a simple programming technique which will help you to rename folder and treat it as a hidden file or redirect user to control panel folder. In this tutorial I use Control Panel as a folder name because once it has been activated, windows will redirect user to control panel. You can replace folder name as you like it but i would suggest to keep it that way. Password can also be set by editing the BAT file in a notepad editor, just remember to save it as “BAT” file. Note: enclose the filename with quotation marks to save it as BAT file, eg. “Lock.BAT”. In that way, notepad will save as BAT rather than TXT File.

<<<<Start of Code>>>

cls

@ECHO OFF

title Control_Panel

if EXIST “Control_Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto UNLOCK

if NOT EXIST Control_Panel 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 Control_Panel “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%== 032003 goto FAIL

attrib -h -s “Control_Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”

ren “Control_Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” Control_Panel

echo Folder Unlocked successfully

goto End

:FAIL

echo Invalid password

goto end

:MDLOCKER

md Control_Panel

echo Control_Panel created successfully

goto End

:End

<<<<End of Code>>>

Ron

Since childhood, the technology of computers was his greatest fascination. Empowered with a degree on Computer Science from AMA University in the Philippines, Ron focused on website and program development. Since then, he has been working with different companies and personalities to achieve their corporate and personal goals by providing technical support for their online presence and program solutions. As today’s technology develops faster than the blink of an eye, Ron never stops exploring not only the new but the coming. His exposure to a wide array of businesses and industries equipped him to be versatile and proficient to go beyond the expectations of his clients. Ron is looking forward to more challenging collaborations where he can further improve his ability to apply the latest trends in providing innovative solutions to the growing demands of website and program development.

You may also like...

Did this work for you?