Better Folder Lock in Batch

by Batchcc in Circuits > Computers

8624 Views, 9 Favorites, 0 Comments

Better Folder Lock in Batch

folder-lock.jpg
So you want to hide files that might be confidential well this will HIDE THEM NOT LOCK THEM the cmd command attrib +s +h makes the file or folder a system file and a hidden file but its easy to unhide them just type attrib -s -h but this code will hide them slightly better.
WARNING: I AM NOT RESPONSIBLE IF YOU LOOSE DATA BECAUSE YOU DONT KNOW HOW TO UNHIDE IT WHICH IS VERY SIMPLE BUT TEST IT BEFORE YOU TRY IT ON AN IMPORTANT FILE.

Basic Bad Folder HIDER NOT LOCKER

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 password to unlock folder
set/p "pass=>"
if NOT %pass%== PASSWORD_GOES_HERE 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

This will hide a folder in the current one open it if it doent work try it again but first change the section that asks you to change password here don't add spaces to the password then save the file as a .bat as seen in my other instructables if you don't know how to do this

Better Folder HIDER

cls
@ECHO OFF
title Folder Private
Cd /d C:\Windows\system32
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 password to unlock folder
set/p "pass=>"
if NOT %pass%== PASSWORD_GOES_HERE goto FAIL
attrib -h -s "HTG Locker"
Start "C:\Windows\System32\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

You may need to fun this as an administrator to do this right click on the file and run as admin this will create the file in C:\Windows\system32 a location windows uses to store important files be very careful DO NOT EVER EVER EVER EDIT OR DELETE FILES IN C:\Windows\System32

Take Ownership of Folder

To do this use the command in cmd.exe
cacls private /e /c /d %username%

Substitute private with the folder name if this doesn't work delete the folder and try the command again

To remove the ownership privlages use the command
cacls private /e /c /g %username%:f
Substitute the folder name where private is

Contact Me

Send me your cool codes here batchcc@gmail.com
See more of my tuts here
https://www.instructables.com/member/batchcc
Thanks for reading