Skip to content

Instantly share code, notes, and snippets.

@0xD9D0
Last active May 7, 2018 16:12
Show Gist options
  • Save 0xD9D0/a444287a76f072a40675f350afc00a49 to your computer and use it in GitHub Desktop.
Save 0xD9D0/a444287a76f072a40675f350afc00a49 to your computer and use it in GitHub Desktop.
A bat file that automates the process of hiding a folder.

This bat file hides a folder named Private and renames it. To unhide the folder you input a password that is coded in the 25th line of this bat file. Replace EnterYourPasswordHere with your desired password.

rem This batch file provides an automated way to hide folders and unhide.
rem replace EnterYourPasswordHere with your desired password
cls
@ECHO OFF
title Folder Private
if EXIST "Locker" goto UNLOCK
if NOT EXIST Private goto MDLOCKER
:CONFIRM
echo Are you sure you want to lock the folder(Y/N)
set/p "choice=>"
if %choice%==Y goto LOCK
if %choice%==y goto LOCK
if %choice%==n goto END
if %choice%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Private "Locker"
attrib +h +s "Locker"
echo Folder locked
goto End
:UNLOCK
echo Enter password to unlock folder
set/p "password=>"
if NOT %password%== EnterYourPasswordHere goto FAIL
attrib -h -s "Locker"
ren "Locker" Private
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
goto end
:MDLOCKER
md Private
echo Private created successfully
goto End
:End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment