To Hide a Folder using "Batch File"
Code for the batch file:
cls
@ECHO OFF
title Folder Private
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Private 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 Private "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%== PUT_YOUR_PASSWORD_HERE goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Private
echo Private created successfully
goto End
:End
Open the file in Notepad. Replace “type your password here” in the LockCode.txt file with the password you want to use to lock and unlock the protected files and folders. DO NOT forget this password. Save the file as LockCode.bat.
You should now have two files: LockCode.txt and LockCode.bat. If you cannot tell which file is which because the file extensions are not displaying, Folder Options from the Tools menu->view tab
Now you should be able to see the extensions for both files.
Double-click on the LockCode.bat file to create a new folder named Private. The new folder is created in the same directory as the LockCode.bat file.
Place any files and other folders you want to protect into this Private folder. Double-click the LockCode.bat shortcut on the desktop again to lock the Locker folder. You are asked if you are sure if you want to lock the folder. Type a Y if you are sure you want to lock the folder. The folder disappears.
To unlock the Locker folder again, double-click on the LockCode.bat file. You are asked to enter your password.
The folder is available again.
Extra:
// To make this a more secure option for locking files and folders, once you have locked the Locker folder, open the LockCode.bat file in Notepad and remove your password. You may either leave it blank or enter a dummy password. Only when you are ready to unlock your files and folders, should you open theLockCode.bat file again and re-enter your password and save the file again.
Then, you can double-click on the LockCode.bat file to unlock the Locker folder. If you don’t take this precaution, anyone can open your LockCode.bat file and view your password.
To open a .bat file in Notepad, you must open Notepad first. If you double-click on the file like you would if you were opening a text file, the file runs instead of opens.
Once Notepad is open, select Open from the File menu. Select All Files from the Files of type drop-down list to be able to see the LockCode.bat file. Then, you can click Open to open the file.
To protect your password, you can also delete the LockCode.bat file and create it again from the original LockCode.txt file when you need to unlock your files.
NOTE: The LockCode.bat file MUST be in the same directory where the Locker folder was created originally for this method of locking files and folders to work.//
BY Manjunathan A