loading

My program is called Keylock. You simply choose your 'key' and it writes a file onto it. then once you exit and re-open without the key in, it will say 'Please insert your key.' until you put your key in.

Main.bat:

@echo off

if exist "Config.bat" goto Skip

set /p Path=Enter a key path.

set /a Num=%random%*1000/32768+1

echo set Path=%Path%>"Config.bat"

echo set Num=%Num%>>"Config.bat"

cls

echo Please insert your key.

echo.

echo ^(Press a key^)

pause>nul

if exist "%Path%" echo Key>"%Path%%Num%.key"

:Skip

call "Config.bat"

call "KeyLoop.bat"

title Menu

:Menu

cls

echo

Menu

echo ----

echo.

echo 1. Begin

echo.

echo 2. Change Key echo.

echo.

set /p ans=Choice:

if %Ans%==1 goto Begin

if %Ans%==2 (

call "Config.bat"

call "KeyLoop.bat"

del "%Path%%Num%.key"

del "Config.bat"

cls

echo Restart to create a new key.

echo.

echo ^(Press a key^)

pause>nul

exit

)

goto Menu

:Begin

::Your code here

KeyLoop.bat:

cls

title Locked

echo Please insert your key.

:KeyLoop

if not exist "%Path%%Num%.key" goto KeyLoop

To Use:

Open Main.bat.

Enter the directory the key will be stored in.

If that folder does not exist create it. e.g. Put in a USB stick.

Put your protected code where it says ::Your code here.

loops like that cause lag, you should think about adding a "sleep" in there somewhere
<p>what is it used to ? </p>
<p>If you know batch code or want to protect a batch game you have, you put that code where it says <strong>::Your code here</strong>. Then you cannot run that code without inserting your key.</p>
<p>i still dont get what you use it too and with what program ?</p>
<p>All code where it says <strong>::Your code here</strong> will not run unless a certain key is detected.</p>

About This Instructable

570views

8favorites

More by JoshyRobot:My Batch Files 
Add instructable to: