Let you want to lock a folder named XYZ in your D:\, whose path is D:\XYZ. Now open the Notepad and type the following
ren xyz xyz.{21EC2020-3AEA-1069-A2DD-08002B30309D}
Where xyz is your folder name. Save the text file as lock.bat in the same drive. Open another new notepad text file and type the following
ren xyz.{21EC2020-3AEA-1069-A2DD-08002B30309D} xyz
Save the text file as unlock.bat in the same drive.
Now, to lock the xyz folder, simply click the lock.bat and it will change into control panel icon/link which is inaccessible. & to unlock the folder click the unlock.bat file. Thus the folder will be unlocked and the contents are accessible.
---------------------
Locking Drives -
Inside RUN type regedit and press enter. This will open the registry editor.To hide any drive you have to follow these two steps
Step1: Hiding -
Goto HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer , now create a new DWORD value NoDrives and set its value as 2^(alpha number of Drive letter-1)
where Alpha number are simple counting of alphabets from A to Z as 1 - 26 for example: to hide C driveAlpha number of C is 3 so 2^(3-1) = 4 (decimal value)If you want to hide more than one drive than calculate the value of each drive as explained and then set sum of those numbers as value.(better be don't do this for (windows) C: drive.)
Step2: Locking -
We make our Drive invisible but it is still accesible so to lock the drive, at
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer , create a new DWORD value NoViewOnDrive and set its value same as you have calculated for hidding the drive.
Now your drive is locked. If you want to unlock and unhidden the drive then just delete these two keys and your drive is again accessible. You can also create two .reg files one for hidding and locking and another one for unlocking and unhidding .