Have you ever wished to lock a folder in your computer, so nobody would know about its contents! If yes here is a simple tool for the same!
All that you need to do is to write a batch file. Here is the code
cls
:Start
@ECHO OFF
title Lock your folder
if EXIST “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” goto UNLOCK
if NOT EXIST LockedFolder goto MAKE
:LOCK
echo Do you want to Lock the folder(Y/N)
set/p “c=>”
if %c%==Y goto LK
if %c%==y goto LK
if %c%==n goto ULTEND
if %c%==N goto ULTEND
echo Invalid choice…
goto LOCK
:LK
ren LockedFolder “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
attrib +h +s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
echo Folder locked
goto ULTEND
:UNLOCK
echo Do you want to unlock the folder(Y/N)
set/p “ch=>”
if %ch%==Y goto UK
if %ch%==y goto UK
if %ch%==n goto ULTEND
if %ch%==N goto ULTEND
echo Invalid choice…
goto UNLOCK
:UK
echo Enter password to Unlock folder
set/p “pswd=>”
if NOT %pswd%==comptalks goto FAIL
attrib -h -s “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}”
ren “Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}” LockedFolder
echo Folder Unlocked successfully
goto ULTEND
:FAIL
echo Invalid password
goto Start
:MAKE
md LockedFolder
echo LockeD Folder created successfully
goto Start
:ULTEND
echo “Thanks for using! Bye”
attrib +h +s LockIt.bat
Copy the above lines in a notepad and save it as LockIt.bat (If you are using a different name, edit the last line of the code accordingly)
Now go to the folder where you saved this file (Say D:), and double click it. A folder by the name “LockedFolder” will be created, and ask you for an option, whether to lock the folder or not. Irrespective of your option now, the LockIt.bat file will now become invisible. Now whenever you need to Lock or Unlock the folder, Go to the location (D: as here), Shift+Right Click ->Open command window here.
The MS-DOS prompt will open. Now type the name of the bat file you created (LockIt). This is how you access the lock. If the folder is locked while you access it, the computer will prompt for a password, which in the above code is set as “comptalks”. If the right password is entered, the folder will be unlocked for use. After the use, once again, you can access the LockIt file from the DOS prompt, and lock your folder.
Actually, the MS-DOS interface can be completely avoided by removing the last line of the code. Then the bat file will always be visible on your folder, and you can just double click it to access it. But it compromises on security. When the last line is kept, the bat file is kept invisible(Remember invisible is different from hidden! Even if your settings say “Show hidden files and system files”, these ‘invisible files’ will not be visible). And since the file is invisible, you can access it, only if you know the exact name of the file!
To change the password, in the MS-DOS prompt, type
attrib -h -s LockIt.bat
Now your bat file is visible. Right click->Edit. Now the file will be opened in notepad. In the line
if NOT %pswd%==comptalks goto FAIL
change the string ‘comptalks’ to any password of your choice!
Mechanism:
Here, when you run the bat file, the folder is converted into a system folder, which will remain invisible. And when you enter back the correct password, it becomes visible. But, in that case, why should the folder name be changed to some strange name, as in the above case. The answer is simple because, if the folder is not renamed into a system name, a simple command like
attrib -h -s *.*
should make the folder visible. However, changing the folder’s name into a system name, will prevent the folder from getting included in the ‘*.*’ set. So the above command will not affect the locked folder.
Warning:
Though the folder is safe from the attrib -h -s *.* command, the bat file is vulnerable. So after that command, the bat file will be visible, and someone, who can read and understand the bat file, can always hack into your “Locked Folder”, nevertheless it is highly improbable, that someone, will suspect, such a locked folder, in that exact location, and type out the command, from MS-DOS prompt, and hack your data! May be if your data, is so valuable, you should then go for a software.
Any comments and suggestions welcome.




From my opinion this is the right move to secure more your data.
Nice post.. really loved this one…