URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       Enigma computing
  HTML https://enigma.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: BAT
       *****************************************************
       #Post#: 51--------------------------------------------------
       Password Code
       By: xeneo Date: January 14, 2012, 3:35 am
       ---------------------------------------------------------
       Hi guys! Today I'm going to teach you to put a password on your
       stuff, even if you normally can't encode it, like a Word
       document! Sound fun? Good. Here we go...
       Open Notepad. That's easy enough. Now to start coding.
       First, you can't let people see the coding you've used for this,
       so hide it:
       [code]@echo off[/code]
       Next, you may want to clear the screen.
       [code]cls[/code]
       Now, you need to tell whoever is trying to open your file to bog
       off, because it has a password.
       [code]echo (whatever you want to tell them)[/code]
       OK, kids, this is where it gets complicated. You may even want
       to copy and paste it all. It isn't cheating if you're not the
       best in the world at programming.
       First, create the password process.
       [code]SET /P password=Password:
       IF NOT '%password%'== SET password-%password:~0, 1%
       IF /I '%password%'=='(type your password here)' GOTO :accepted
       IF NOT '%password%'=='(type your password here)' GOTO
       :declined[/code]
       Told you it was complicated.
       Now, tell Command Prompt what you want to do when the password
       is correct. In this example, we will use Notepad.
       [code]:accepted
       @echo off
       echo (message saying password is accepted here)
       ping 127.0.0.0 -n 2 >nul
       C:\Windows\notepad[/code]
       You see how we use the IP of the localhost, instead of typing
       'localhost'? This is because if you try to ping localhost with
       no internet connection, it won't work, but if you ping the IP,
       it will, because it pings you. The '>nul' part is to make it
       invisible to you when you run the program. The '-n 2' part is
       saying you wait for two seconds, as it takes a second to ping
       once.
       Now for declining the password:
       [code]:declined
       @echo off
       echo (tell them that it was declined)
       ping 127.0.0.0 -n 3 >nul
       (now choose what to do to them for trying to hack your stuff,
       e.g. type 'exit' to exit CMD)[/code]
       Now save it as anything, but put '.bat' at the end! Try testing
       it to see if to works.
       You don't need to run Notepad with the program you write, just
       change the 'C:\Windows\notepad' bit to the file location of what
       you want to run! And remember, make a shortcut to it to change
       the icon!
       That's it! Happy encoding!
       --Xeneo
       *****************************************************