Create a folder privacy program using a batch file

Wrote your own tutorial? Submit it here!
Post Reply
electro-technic
forum buddy
forum buddy
Posts: 15
Joined: 08 Mar 2010, 17:00
14
Location: Calgary, Alberta, Canada
Contact:

Create a folder privacy program using a batch file

Post by electro-technic »

Hello

This is another tutorial I have written for your, and my own enjoyment.

This will show you how to create a batch file in Windows that will allow you to store files into then hide or unhide and protect with a password. This info can also be found easily elsewhere online, but I have adjusted the code to have it be more explanitory aswell as took it a step further to completely protect the password too. The first step will be to create the batch file. Copy and paste the code below into a notepad then save it as "ghost.bat". Just be sure to switch the text on line 27 that says "PASSWORDGOESHERE", with a password of your own.

-----------------------------------------------------------------------------

@echo off
cls
title ghost folder
if exist "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNHIDE
if not exist ghost goto CREATE
:CHECK
echo Do you want to hide the folder?? (Y/N)
set/p "i=>"
if %i%==Y goto HIDE
if %i%==y goto HIDE
if %i%==N goto DONE
if %i%==n goto DONE
cls
echo ERROR... Y or N only...
pause
cls
goto CHECK
:HIDE
ren ghost "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo folder is hidden...
pause
goto DONE
:UNHIDE
echo enter the password to unhide the folder...
set/p "j=>"
if not %j%==PASSWORDGOESHERE goto WRONG
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" ghost
echo folder is visible
pause
goto DONE
:WRONG
echo invalid password
pause
goto DONE
:CREATE
echo "ghost" folder will now be created...
pause
cls
md ghost
echo run program again to hide and show the folder.
pause
goto DONE
:DONE

-----------------------------------------------------------------------------

Now, the program is functional at this point. But your password can be easily viewed by editing the batch file. To prevent this, you can use a program called "bat to exe converter", to turn the batch file into an executable file. This prevents the possibility of viewing the code (protecting the password). I will provide a link to download it at the end of the tutorial.

WHAT THE PROGRAM DOES

1-First it checkes to see if a folder called "ghost" exists, if not, it will create it for you.

2-When run again, it will ask if you would like to hide the folder or not.

3-If it's hidden, when run again, it will ask for the password and reveal it for you if the password is correct.

THE DELETED PROBLEM SOLUTION

Question-What if the folder is hidden and I delete the program

Answer-Re-create the batch file with the same password, place it into the same directory as the hidden folder, then run the batch file. (Actually, the password might (shouldn't) matter in this case).

Now, to protect the password, convert the .bat, to a .exe, using the converter provided by the following link...

http://download.cnet.com/Bat-To-Exe-Con ... 55897.html

And there you have it. Delete the original batch file and you now have created your own program for keeping a folder private. Hope you enjoy.

Post Reply