Skip to content

Instantly share code, notes, and snippets.

@sony-mathew
Created February 20, 2018 17:58
Show Gist options
  • Save sony-mathew/2ccbc8ae3c5b6e2c50d2a9a8561412c2 to your computer and use it in GitHub Desktop.
Save sony-mathew/2ccbc8ae3c5b6e2c50d2a9a8561412c2 to your computer and use it in GitHub Desktop.
Hide folders in windows operating system using this script. You can password protect it and view and open it without unhiding it. Used shell. [cmd]
@echo off
setlocal enabledelayedexpansion enableextensions
:: Hide a folder in windows xp, windows 7 or windows 8 with a password.
:: Follow the steps as follows :
:: 1. Open private.bat file in a text editor say notepad or geany.
:: 2. On line 5, you have set "directory=e:\private".
:: Change the path from e:\private to your specified folder to hide.
:: If the path contains spaces then enclose in double quotes.
:: For eg: if your path is "f:\cool Guys" then change the line 5 to set directory="f:\cool Guys".
:: 3. Now to change the password, on line 8 change the set password="your required password"
:: 4. Now place the private.bat file anywhere you like and double click.
:: You will be asked the password, type in the password and press enter.
:: 5. Play it nice n easy and njoy a lil privacy for your files.
REM set the directory of file or folder to be protected
set directory=e:\private
REM set the your password here
set password=simple
:top
REM dont change any code given below
set /p passcheck="Enter your password : "
if %passcheck%==%password% (
echo Password is Correct.
:sub
set /p job1="Enter h to hide , u to unhide,o to just open the folder or e to exit : ")
cls
if %job1%==u (
attrib -h -s -r -a %directory%
echo Succesfully unhidden the directory %directory%
explorer %directory% )
if %job1%==h (
attrib +h +s +r +a %directory%
echo Succesfully hidden the directory %directory% )
if %job1%==o (
explorer %directory%
echo Succesfully opened the directory %directory% )
if %job1%==e (
goto:theend )
if %passcheck%==%password% (
goto:sub )
if not %passcheck%==%password% (
echo Sorry. The password you provided is incorrect.
goto:top )
:theend
echo Thank you for using vault.
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment