How to Make a Computer Lock

12,324

13

14

Introduction: How to Make a Computer Lock

About: I find a quote from Bill Gates makes a very good description. "Be nice to nerds. Chances are you'll end up working for one."

Do you have a computer that someone knows the password, or are to lazy to lock the computer when you leave, even for a minute? Well this is an instructable our friendly neighborhood nerd has made for us. You will need:

a computer (running Windows 3.1 or higher)
notepad or other simple text editing software
arms and legs are optional if you have speech recognition
keyboard

NOTE:This will not work on Macs (sorry macs)

Step 1: Open Notepad

First open notepad.

Win 95-2000, Me
Start>Programs>Accesories>Notepad

Win XP and up
Start>All Programs>Accesories>Notepad

If you see the window shown below then you have notepad.

Step 2: Code

Copy and paste this code:

dim Password
dim Input

Password = inputbox ("Enter the password","Password","Enter text here")
do
Input=inputbox ("This computer is locked. Enter the password.","Password","Enter text here")
if Password = Input then
a=msgbox ("Correct! Welcome back.",0+64,"Computer")
else
if Input = "0000" then
b=msgbox ("Reset code entered.",0+64,"Computer")
else
c=msgbox ("Incorrect. Try again.",0+16,"Computer")
end if
end if
loop until Password = Input or Input = 0000

Step 3: Reset Code

Look for the part of the code that says

if Input = "0000" then

and also

loop until Password = Input or Input = 0000

These are the program's reset codes. If you forget your password the reset codes will allow you in. You can change them to any number you want but both the 0000 parts of the code must be the same for this to work. For example they could be the year you were born or your house #.

Step 4: Save Me!!

To make this script work we need to save it in a special way, follow along carefully. :o

Go to
File>Save As

Now we can save it as anything you want, but it has to end with the file extension .vbs

ex.
CompLock.vbs

Step 5:

Test this program. The best part of this program is you can add a new password every time, so if an annoying sister, brother, parent, co-worker ect. finds out your password you can add a new one the next time you run this program. As always comment any problems this program has so I can debug it. Super_Nerd signing out.

Be the First to Share

    Recommendations

    • Furniture Contest

      Furniture Contest
    • Home Decor Challenge

      Home Decor Challenge
    • Toys & Games Contest

      Toys & Games Contest

    14 Comments

    0
    lanky.ninja
    lanky.ninja

    9 years ago on Introduction

    What stops the user from simply minimising the popup?

    0
    ishaq45
    ishaq45

    Reply 6 months ago

    hi

    0
    Super_Nerd
    Super_Nerd

    Reply 9 years ago on Introduction

    There isn't a minimize button, and the X is greyed out. The only way to stop this from running is to go to task manager and kill the wscript.exe process. This isn't brick solid though, as you can still use the computer behind this. This program was intended to keep people who don't know much about computers off. A way to make this more secure would be to disable explorer.exe until the computer is unlocked.

    0
    xp4xbox
    xp4xbox

    5 years ago

    lol, you could just ctr-alt-delete to bring up taskmgr and start up explorer.exe. Also if you are going to use the Taskkill command to kill explorer.exe you need the /f switch.

    0
    BigMikeDog
    BigMikeDog

    9 years ago on Introduction

    im using this code can anyone help me with the line in the { }'s
    @echo off
    Title computer lock
    cls

    :Lock
    echo "Please inter a password to lock your computer"
    set/p "1Pass=>"
    taskkill /IM explorer.exe
    cls
    echo "This Computer is locked."

    :Locked
    taskkill /IM explorer.exe
    echo "Please type the password to unlock the computer"
    set/p "2Pass=>" {this line needs to be skiped if nothing is enterd so it becomes a if enter key hit then take entered value and set it as varlable 2pass anyone know a way to do that?}

    :Unlock
    if %1pass%==%2pass% then goto End
    goto Locked

    :End
    echo "Have a nice day!"
    PAUSE

    0
    Prof. Pickle
    Prof. Pickle

    Reply 8 years ago on Introduction

    I know this is sort of too late, but I couldn't help myself. Here is the edited code:

    @echo off
    Title computer lock
    cls

    :Lock
    echo Please inter a password to lock your computer
    set /p 1Pass=>
    taskkill /IM explorer.exe
    cls
    echo This Computer is locked.

    :Locked
    taskkill /IM explorer.exe
    echo.
    echo.
    echo Please type the password to unlock the computer
    set /p 2Pass=>

    :Unlock
    if %1pass%==%2pass% then goto End
    goto Locked

    :End
    echo Have a nice day!
    PAUSE

    I don't exactly get what you mean, but from what I can tell, it seems irrelevant. The code is already doing what you asked.

    Tip: Don't spam quotation marks.

    0
    Prof. Pickle
    Prof. Pickle

    8 years ago on Introduction

    Excellent job, as per usual. But, can't they just exit out of it? It isn't very effective. Can you make it more so?

    0
    BigMikeDog
    BigMikeDog

    9 years ago on Introduction

    When i run it says it's lock but i still can open folders and applications it dosent seam to lock can you help?

    0
    Super_Nerd
    Super_Nerd

    Reply 9 years ago on Introduction

    You could make it stop explorer.exe and restart it when the password is entered. I'm not very good with windows shell objects but you can make it run a batch file to stop and restart explorer.

    0
    BigMikeDog
    BigMikeDog

    Reply 9 years ago on Introduction

    ok thanks i know that will work but i got know idea how do do that :- \

    0
    Super_Nerd
    Super_Nerd

    Reply 9 years ago on Introduction

    Sorry but I'm not the best at batch files. Maybe you could try

    taskkill explorer.exe

    to freeze any background use

    and in another file

    start explorer.exe

    to unlock the computer
    Sorry if this doesn't work.

    0
    BigMikeDog
    BigMikeDog

    Reply 9 years ago on Introduction

    yep they both work but you do taskkill /IM explorer.exe
    the only problem is that 7 is protected form killin the program so then i just restarts it self

    0
    knexinglemon
    knexinglemon

    9 years ago on Introduction

    lol for mine if you click the x button two times it sais correct welcome back

    0
    Super_Nerd
    Super_Nerd

    Reply 9 years ago on Introduction

    That' because when you press the x, without entering anything, the computer assumes your password is nothing. When you x again, nothing was entered just like when you x-ed before, so it lets you back in.