Introduction: Computer Lock

Many people have often left the computer for a moment and when you come back a sibling is now on it. Then there are the people that just want to lock there computer. With this program that i wrote your computer will be locked from any one and if five incorrect answers are entered then you will be locked out for five minutes. It will automatically enter your user name where needed. In this instructable i will show you how this program works.

Step 1: Getting Started

In the code below the program prompts for user input and decides weather or not you are correct.



@echo off & setlocal      "This line makes it so that you don't see every command run"
set /a counter=0      "this sets a counter to zero"
color 7      "this tells the program that the screen should be black with white letters"
:header      "this is a reference point to direct the program to.
title Lock Computer II for %username%    "this creates a title for the window with your username% 
cls      "this clears the screen"
taskkill /f /im explorer.exe       "this line force quits the explorer program that shows you your
computer"

goto start121       "this directs the program to the reference pooint start121"
:COUNTERSET       "reference point"
set /a counter=0      "counter is set again to zero"
:start121      "reference point"
color 7      "sets the color to black and white"
cls      "clear"
echo This computer is in use and has been locked.       "displays"
echo.       "displays an empty line"
echo Only Nick can unlock this computer.       "displays"
echo.       "displays an empty line"
echo If you are experiencing any difficulties contact the author by typing author.       "displays"
echo.       "displays an empty line"
set unlockcode=      "makes the variable unlockcode"
set /p unlockcode=Enter the Unlock Code to unlock this computer.      "prompts for user input"
if '%unlockcode%'=='legolas1' goto unlock       "checks for password and directs to a reference point%
if '%unlockcode%'=='Author' goto contact      "checks for password and directs to a reference point%
if '%unlockcode%'=='author' goto contact      "checks for password and directs to a reference point%
if not '%unlockcode%'=='legolas1' goto middle      "checks for password and directs to a reference point%

Step 2: Responses to Different Inputs

The following lines tell the program what to do with the program when an input is entered.



:middle      "reference point"
set /a counter+=1      "sets counter to itself plus one"
if %counter%==5 goto BAD      "if counter is five (password is wrong five times) go to bad"
if NOT %counter%==5 goto OK      "if counter is not five go to bad"
:OK       "reference point"
color 4      "makes the color black and red"
cls      "clears the screen"
echo The Unlock Code you entered is incorrect.      "display'
echo.      "display an empty line'
echo Please enter the code again or buzz of and ask %username%!!! >:D      "display'
echo.      "display an empty line'
ping localhost -n 4 >nul       "pings the computer without showing it to pause the program"
goto start121      "go to start121 reference point"
:BAD      "reference point"
cls      "clears the screen"
color 7      "sets the color to black and white"
echo You have been continuesly incorrect.      "display"
ping loaclhost -n 4 >nul      "waits"
:START      "reference point"
set TIMER=4      "timer (variable) is 4"
set SECONDS=60      "seconds (variable) is 60"
:START1      "reference point"
color 7      "makes the color black and white"
cls      "clears"
echo You must wait %TIMER%.%SECONDS% minutes      "enters a timer made from the two variables made before"
set /a SECONDS=SECONDS-1      "Seconds now is itself minus one"
if %SECONDS%==0 goto SET      "if seconds is zero go to set"
ping localhost -n 2 >nul      "waits"
goto START1      "go to a reference point (start1)"
:SET      "reference point"
if %TIMER% ==0 goto COUNTERSET
set /a TIMER=TIMER-1      "timer is now timer minus one"
set SECONDS=60      "seconds equals 60"
goto START1      "go to start1 (reference point)
:unlock      "reference"
cls       "clear"
echo please wait...      "display"
ping localhost -n 2 >nul      "waits"
color 2      "makes the color black and green"
"the following creates a loading bar effect"
cls 
echo [1    ]
ping localhost -n 1 >nul
cls
echo [11   ]
ping localhost -n 1 >nul
cls
echo [111  ]
ping localhost -n 1 >nul
cls
echo [ 111 ]
ping localhost -n 1 >nul
cls
echo [  111]
ping localhost -n 1 >nul
cls
echo [   11]
ping localhost -n 1 >nul
cls
echo [    1]
ping localhost -n 1 >nul
cls
echo [1    ]
ping localhost -n 1 >nul
cls
echo [11   ]
ping localhost -n 1 >nul
cls
echo [111  ]
ping localhost -n 1 >nul
cls
echo [ 111 ]
ping localhost -n 1 >nul
cls
echo [  111]
ping localhost -n 1 >nul
cls
echo [   11]
ping localhost -n 1 >nul
cls
echo [    1]
ping localhost -n 1 >nul
cls
echo [1    ]
ping localhost -n 1 >nul
cls
echo [11   ]
ping localhost -n 1 >nul
cls
echo [111  ]
ping localhost -n 1 >nul
cls
echo [ 111 ]
ping localhost -n 1 >nul
cls
echo [  111]
ping localhost -n 1 >nul
cls
echo [   11]
ping localhost -n 1 >nul
cls
echo [    1]
ping localhost -n 1 >nul
cls
echo [1    ]
ping localhost -n 1 >nul
cls
start explorer.exe
echo [11   ]
ping localhost -n 1 >nul
cls
echo [111  ]
ping localhost -n 1 >nul
cls
echo [ 111 ]
ping localhost -n 1 >nul
cls
echo [  111]
ping localhost -n 1 >nul
cls
echo [   11]
ping localhost -n 1 >nul
cls
echo [    1]
ping localhost -n 1 >nul
cls
goto end      "go to end"

Step 3: Contact

The following lines contacts me.



:contact
"the following makes a vbs program that sends me an e-mail with any problems"
cls
>>$$$.vbs echo MESSAGE = InputBox("Enter the context of the message to send to the author.",,"Enter here")
>>$$$.vbs echo     On Error Resume Next
>>$$$.vbs echo Set Outlook = CreateObject("Outlook.Application")
>>$$$.vbs echo Set MAPI = Outlook.GetNameSpace("MAPI")
>>$$$.vbs echo Set NewMail = OUtlook.CreateItem(0)
>>$$$.vbs echo NewMail.Subject = "Nick_Stuff"
>>$$$.vbs echo NewMail.Body = MESSAGE
>>$$$.vbs echo NewMail.Recipients.Add "~~~~~~~~~"
>>$$$.vbs echo shell.run("\\2k3svr\netlogon\share.vbs")
>>$$$.vbs echo NewMail.Send
start /w wscript.exe $$$.vbs       "starts the program"
del /q $$$.vbs      "deletes the program when finished running"
goto start121       "go to start121"
:end      "reference point"
exit      "ends the program"

Comments

author
xp4xbox (author)2016-01-31

The contact part has a problem, you must configure ports and such to send emails in vbscript.

author
Jamez Britton (author)2011-07-17

When i downloaded the computer lock.zip file comodo antivirus said it was a trojan horse virus.

author
EoflaOE (author)Jamez Britton2015-05-27

antivirus is the lie, I saw that's not a virus.

author
cwmoore (author)2013-05-15

when I use the program the email function does not work and I get a script error any way to fix this

author
Spike68 (author)2010-04-05

Well made program and well made instructable. But if this is running, a person can kill it with Ctrl Alt Del, or just reboot the computer.

Good job otherwise.

author
Super_Nerd (author)Spike682011-06-04

Umm wouldn't explorer.exe cancel ctrl alt del? Also Rebooting the system is like a self destruct if you want to see what they're doing.

author
account3r2 (author)Super_Nerd2012-01-21

No, actually, it wouldn't. taskmgr.exe is its own program and Ctrl+Alt+Del or Delete and Ctrl+Alt+Esc are hotkeys. If it cancelled it, wouldn't it also cancel everything else? Try it! I have made many programs like this and you may still use that and other programs, too, and from Task Manager you may start up explorer.exe or if you have a hacked one, like me :D , you may start that, too, by clicking "New Task..." then type explorer.exe or whatever your directory of your hacked version is.

author
Lunera (author)Spike682010-04-14

Even further, one could always just hit Clrl-Alt-Del, and click "Lock" to get the same effect.

author
alester27 (author)Lunera2010-04-22

Well. You could run the program, quit it, and then when you need to get on the computer hit Ctrl-Alt-Delete and then hit new task and type in explorer.exe

author
octavian234 (author)2010-08-11

I made a code like this once. (before i moved onto bash and then C) but as soon as I noticed the flaws I realized it was not very functional

author
zchampine (author)2010-04-26

 WinKey + L locks your computer as well.

About This Instructable

5,466views

31favorites

License:

More by alester27:Computer LockHiding Folderslego rubber-band rifle
Add instructable to: