loading

If you have ever wanted to create and control time, this is not exactly the right place. I can, however, teach you how to write a program for a clock. I will be showing you how to use Notepad on a Windows computer to design your very own program in the batch language.

To be honest with everyone reading this, if you don't really want to read all that I type, the pictures are self-explanatory for the most part.

WARNING: IT IS ILLEGAL TO DISTRIBUTE BATCH FILES OVER THE INTERNET.



Materials: Windows Computer, Notepad

Step 1: Open Notepad

Open Notepad... If you don't know how to open Notepad then you shouldn't program a clock.

Step 2: Starting It

To start off, type

@echo off

this code is basically saying that you want your program to display something.

Step 3: Still Starting It

The next code on a new line is

:start

The " : " means that you have a specific point you want to return to. I then typed "start" to specify a name for this point. You can use whatever you want, i only used "start" for the sake of simplicity.

Step 4: Getting Into It

More code

cls

This code is just a shortened version of the words "Clear Screen". And that is what it does. Later on we will find that clearing the screen makes the program run smoother and visually attractive.

Step 5: Timing

Codes, codes, codes

echo %time%

The code "echo" tells the program to prompt whatever follows on that line.

The %time% just means to display the time that the computer has.

Step 6: Goto Step 6

[Insert funny one-liner here]

goto start

Whoever made this programming language honestly just put the words "go" and "to" together and made it go to a specified point. In this case, I made it go back to "start". Don't Pass Go. Don't Collect 200.

Step 7: Don't Forget to Save

Saving a program from Notepad is different from saving a text document. There are a few step you must take for it to work correctly.

  1. Where it says "Save as type", choose the option "All Files".
  2. Save your program as Clock.bat . The ".bat" tells the computer what programming language you used

Choose a safe place to save this and hit save.

Step 8: You Are a Programmer Now

You have now officially written a program. Now if you open it you may notice that it looks a little sketchy, but no worries. These next few steps will show you how to amp up your program.

Step 9: Make It Pretty

Lets add some color to our project. Add the command

color 0a

to a new line under "@echo off". "0a" Is just a color code for light green text on a black background. You can use any color combination you want, but 0a is the most stereotypical color scheme for a hacker.

Step 10: Make It Prettier

If you opened the program then you would have noticed that it flashed each time at you. I found this to be distracting and ugly, so I added the command:

timeout 0 /nobreak>null

This is a more advanced command, so I won't explain it all to you. It basically tell the program to wait for "0" seconds and then continue without letting the user know it paused. If you look up the "timeout command", you can learn more.

Step 11: It's So Pretty

Almost done. Add the command:

title Clock

on the first line, on its own line.(Reference the picture above). This just make the name of window that will open "Clock".

And now you're Done.

Step 12: It's All Over Now

When you open it now it should look a lot nicer and more appealing. I simply shrunk mine down to a reasonable size.

This was the first program I ever wrote when I was first starting out (Not as advanced obviously) and still enjoy the look of it. I hope to have inspired all of you to carry on with writing programs, but if not, at least you have a new clock.

Have a good day while never having to worry about what time it is ever again.

WARNING: DO NOT DISTRIBUTE ANY BATCH FILES OVER THE INTERNET, THEY CAN CAUSE HARM TO OTHERS' MACHINES EASILY. NEVER DOWNLOAD A BATCH FILE FROM THE INTERNET. NEVER OPEN A BATCH FILE BEFORE YOU ARE 105.7% SURE IT IS SAFE. I AM NOT RESPONSIBLE FOR ANY HARM CAUSED TO YOUR MACHINE.

<p>which software is required to open the file</p>
<p>made a nifty kind of better clock just used some code from this Instructable and payed it up with this Instructable and change a few things heres code:</p><p><strong>@echo off</strong></p><p><strong>setlocal delayexpansion</strong></p><p><strong>cls</strong></p><p><strong>colous cursoroff</strong></p><p><strong>@mode con: cols=35 lines=7</strong></p><p><strong>title Clock</strong></p><p><strong>color 0a</strong></p><p><strong>:time</strong></p><p><strong>echo. &Uacute;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&iquest;</strong></p><p><strong>echo. &sup3; %time%&sup3;</strong></p><p><strong>echo. &Atilde;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&acute;</strong></p><p><strong>echo. &sup3; %date% &sup3; </strong></p><p><strong>echo. &Agrave;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Auml;&Ugrave;</strong></p><p><strong>timeout 0 /nobreak&gt;nul</strong></p><p><strong>ping -n 2 0.0.0.0 &gt;nul</strong></p><p><strong>cls</strong></p><p><strong>goto :time</strong></p>
<p>What is this fascination with batch files anyway? If you're interested in virii, this seems like such low-hanging fruit that it wouldn't be worth the effort....?</p>
I'm quite sure sending batch files is legal, unless you live in an odd country.
<p>What lead you to believe sending batch files is illegal? By this standard sending VBS, ruby, python, and any other source files is illegal as well.</p>
Sending a batch file itself is by illegal, but sending a malicious one is.
<p>Simple, cool and funny. Thanks!</p>

About This Instructable

10,471views

28favorites

Bio: I might do something if you watch long enough
More by -_ - wAT:How To Program A Clock How To Be A Fake Hacker 
Add instructable to: