Password Protected Folder

Password protected folder using VBScript

Now I am going to show you How to open your Folder by Entering a Password. That means you can protect your data in particular folder. Whenever you want to open this Folder then you have to Enter your password because I will use “Attrib” command of DOS for hide Folder and then I will Open it by password. So here is VB Script code to Open that Folder by password. Let’s Start.

Step 1 : Open your notepad [Start >> Run >> Type “notepad“ >> Press Enter]

Step 2 : Copy The Following Code in notepad and save it as “Locker.vbs”



Sub Run(ByVal sFile)

Dim shel

Set shell = CreateObject(“WScript.Shell”)

shell.Run Chr(34) & sFile & Chr(34), 1, false

Set shell = Nothing

End Sub

Dim storedPassword

storedPassword =”errorcode401″

password = InputBox(“Please enter password to unlock ‘My Locker’.”,”Locker by TheKnowledgeFactory”)

if password = storedPassword Then

Run “D:My Locker”


WScript.Echo “Opppsss, wrong Password!”

End if

Step 3 : Now Create One Folder in “D” Drive name with “My Locker”

Step 4 : Now Open your Command Prompt and type the following command one by one.


              Cd /d D:
              Attrib +s +h “My Locker”

              Then Close it.

>> That’s it…!!!

Now You Folder “My Locker” is Hidden when you want to open that folder you have to double click on “Locker.vbs” and then you have to provide password to open it.

[Attrib Command is just use to Set the Attribute of File/Folder, Here we are just setting attribute as system and Hidden Folder, So it is possible to anyone can unhide your folder who knows “Attrib” Command]

Change your Password :

Default Passwprd is “errorcode401”. To change it Right Click on Locker.vbs then Click on EDIT then Find for “errocode401” and Replace it with your password.

[Note : This is not good Locker as your need because you can easily see your password by opening it in notepad]