Aug 21, 2009

Password protect a folder.

Posted by Aayush at 9:05 PM
I will not be responsible if you lose your files or folders by using this method.
There are various softwares on the market, using which you can completly password protect your folder and important stuffs inside it. But some of them might be malicious or too expensive for a regular person to dowload, so here is a tutorial on how to password protect a folder using VBS scripting(dont worry, you wont have to install anything if you already have windows).
  • First off, start a new page on notepad and paste the following code on it:
cls
@ECHO OFF
title Folder myfolder
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST myfolder 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 myfolder "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%==password goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" myfolder
echo Folder unlocked successfully
goto End
:FAIL
echo Invalid password
goto UNLOCK2
:FAIL2
echo Invalid password
goto end
:MDLOCKER
md Personal
echo Folder created successfully
goto End
:UNLOCK2
echo Last chance to enter correct password to unlock folder
set /p "pass=>"
if not %pass%==password goto FAIL2
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Personal
echo Folder unlocked successfully
:End
  • Now change "myfolder" (line 3, 5, 16 and 25) into the name of your folder and change "password"(line 23) into your desired password.
  • Now go to File>Save As and locate where your folder is located.
  • Save the file as "lock.bat" and save and exit.
  • If you double click the file the first time, it will ask you "if you want to lock the folder or not?" Press Y if you want to, N if you dont want to.
  • Now your folder has disappeared, which means now it is protected from intruders. To restore the folder, double click your "lock.bat" and it will ask for your password. If you enter wrong password twice, it will automatically close the dialogue box and you will have to open it again.
Please remember to hide your "lock.bat" from places where other people can easily find it. Remember the location of the folder that you locked becuase you need to keep "lock.bat" back in that place (if you moved from original locaiton) to restore the folder.

0 comments on "Password protect a folder."

Post a Comment

 

Computer Tutorials Copyright 2009 Reflection Designed by Ipiet Templates Image by Tadpole's Notez