Showing posts with label Batch. Show all posts
Showing posts with label Batch. Show all posts

How to hide folder with password in Windows

It's easy to hide folder in linux, by just adding a dot infront of the name of a folder, but in Windows, you'll have to create one batch file for this. I'll tell you how,

Copy and paste this in Notepad,

cls 
@ECHO OFF 
title Folder Private 
if EXIST "HTG Locker" 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 "HTG Locker" 
attrib +h +s "HTG Locker" 
echo Folder locked 
goto End 
:UNLOCK 
echo enter the key 
set/p "pass=>" 
if NOT %pass%== PASSHERE goto FAIL 
attrib -h -s "HTG Locker" 
ren "HTG Locker" Private 
echo Folder Unlocked successfully 
goto End 
:FAIL 
echo Invalid password 
goto end 
:MDLOCKER 
md Private 
echo Private created successfully 
goto End 
:End
The Black colored letter Indicates the Password, change it to your desired password. Then Save this as key.bat, whatever the name be, but .bat extension is necessary. Save this wherever you want. opening this file will create a new folder in the folder you've saved the .bat file named Private. Copy and paste whatever you want to hide, to this folder. Again, Open this batch file and it will ask you 'Are you sure you want to lock the folder(Y/N)' then type y and press enter. This will hide the folder. to unhide the folder, open Batch file again and it will ask for your Password, type your password and Press enter. 
Continue Reading