Wow..today I came to know how to write my own folder protector and safe guard my files with out using any software. I started my career in IT as a Software Instructor for teaching people as Computer fundamentals, DOS, MS-Office etc.
At that time I knew that DOS is Powerful and has the capacity to do many low level works but not had the idea that it can create a utility file for me when I am searching for a software to protect it from the guys who stoles the data.
here is the Bat file content.
MyFolderLocker.bat
cls
@ECHO OFF
title Folder Technade
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Technade 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 Sudarsan "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% = = sudarsan123$ HERE goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Sudarsan
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Sudarsan
echo Sudarsan created successfully
goto End
:End
@ECHO OFF
title Folder Technade
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Technade 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 Sudarsan "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% = = sudarsan123$ HERE goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Sudarsan
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Sudarsan
echo Sudarsan created successfully
goto End
:End
Here the password is sudarsan123$, you can change the password as per your wish.
Lets go for a test:
Copy the bat file which you had created from the above content, now take it to the place where you want to hide the files.
Here create a folder name Sudarsan and store your files you want to protect . Now run the batch file by double clicking it.
For unlocking again , run the file it will ask for password and here i had used sudarsan123$, once you provide the password correctly it will unlock the folder.
Happy Coding......