Password Lock a Folder
This Instructable is about the creation of a folder that can only be accessed through a password program.
What's needed is a Windows Computer and Notepad. It involves the use of use of a Batch and a VBScript program.
Step 1 will talk about Folder creation.
Step 2 will talk about the program creation.
Step 3 will talk about the reasoning behind my madness.
So to the critics please read Step 3 first. Thank You to those who do.

Step 1: Creating the Folder

Password Lock a Folder
Password Lock a Folder
You need to create a Hidden Folder first.
To do this you first create a folder. In this case the folder will be FOLDER.
Now a Batch File should be created to hide the folder.
I'll explain before you post comments about how you could do it using Properties.
I mean a System Hidden Folder not just a Hidden Folder.
The reasoning behind this is that System Hidden Folders are much harder to access.

Open up Notepad and copy the following.

attrib "FOLDER" +s +h

(You can change FOLDER to the name of your folder.)
Now save the file as Hidden.bat
(Make sure the Save as Type is not set to Text File. It should be All Files.)
Run the program and refresh the window.
Your folder should now disappear.

Step 2: Creating the Password Program

Password Lock a Folder
Password Lock a Folder
I will be using VBScript as the programming language for my Password Lock Program.
My code includes a little sting to keep people away from hacking me.
I will talk about the sting at the end of the page.
The password I will be using in the example is PASSWORD.
The folder that I will be opening is FOLDER.
Now for the code.
First open up Notepad and input the following.

dim count
count = 0
Set objNet = WScript.CreateObject("WScript.Network")
result = MsgBox("Are you sure you want to continue?" ,vbYesNo+vbInformation, "Are you Sure?")
if result = 6 then
strComputer = "."
strProcessToKill = "explorer.exe"
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = '" & strProcessToKill & "'")

For Each objProcess in colProcess
count = count + 1
wscript.sleep 100
loop until count = 20
password =Inputbox("Please Enter your Password","Password Required")
if password = "PASSWORD" then
WScript.Echo "Correct Password"
Set WshShell = CreateObject("WScript.Shell")
Dim objWMIService, objProcess, objCalc
Dim strShell, objProgram, strComputer, strExe

strComputer = "."
strExe = "explorer.exe"
' Connect to WMI
set objWMIService = getobject("winmgmts://"_
& strComputer & "/root/cimv2")

' Obtain the Win32_Process class of object.
Set objProcess = objWMIService.Get("Win32_Process")
Set objProgram = objProcess.Methods_( _
objProgram.CommandLine = strExe

'Execute the program now at the command line.
Set strShell = objWMIService.ExecMethod( _
"Win32_Process", "Create", objProgram)
WshShell.Run "FOLDER"
Set WshShell = Nothing
exit do
elseif password "PASSWORD" then
WScript.Echo "Incorrect Password"
end if
loop until password = "PASSWORD"
end if

(You can change FOLDER to the System Hidden Folder you made)
(You can change PASSWORD to the your own password. Just do it for all the PASSWORDS's that you find.)

Now save the file as Password.vbs. Make sure the Save as Type is set to All Files.
As long as this File and the Folder are in the same directory it should work.

Now about the little sting I put in.
It ends the explorer.exe process.
Don't panic it's completely safe as far as I know. (I've already tried it at least 50 times)
In simple terms what it does is makes your Desktop Icons and Task Bar disappear.
The programs that you have running such as this browser would still continue running.
If the password that is answered is correct the explorer.exe process is started again.
To get it back you could also use Task Manager to start the process.
You could also just Log Off, Shutdown, etc.

Comment if you think there are any improvements that can be made or if there are errors.

Step 3: The Method to my Madness

Password Lock a Folder
First off to those skeptics of System Hidden Folders I provide the following experiments that you can do.

To those who know how to program with Batch.
Use the Dir command on the directory the System Hidden Folder is in.
The display result won't include the name of the System Hidden Folder.

To others.
Go to Control Panel.
Change the Hidden Folders and Files option to Show.
Go back to where the System Hidden Folder is.
You shouldn't be able to find it.

Second to those who feel that my Password program can be breached.

Nothing is impossible to be breached you can only make it as impossible as you can make it.
I only made it as impossible to breach as I could with my limited ability to program.
You may feel that someone can just open the code up and change or find the password.
The person could also find the targeted folder and start it using their own Batch or VBScript program.
I realize these facts and do it on my friends.
The best way to overcome this is to encrypt the code.
I prefer using Scrypt Cryptor which has a unregistered version that can be downloaded here

Third to those who looked closely at the Password Lock code and realized some things.

First I have a Do You Wish to Continue window pop up.
The reason I do that is to give the user a chance to get out of the program.

Second you may realize that until the right password is entered it will continue looping.
This is because I feel that I gave the user a chance to get out. So if he or she didn't take it. Oh Well.
A way to get out of the program is to end the wscript.exe process with Task Manager.
You could also just Log Out or Shutdown.

Third you may realize that I made the program end the explorer.exe process 20 times.
I did this because when you just do it once or twice the process would pop up again.

If I haven't addressed you concerns or thoughts just comment.


Tag cloud

make build easy simple arduino making homemade solar laser printed portable cheap mini building custom cardboard wooden create super lego turn paracord chocolate your paper light intel