Introduction: Cool Batch Files

Picture of Cool Batch Files

OK, I'm going to assume that you already have batch experience and don't need me to explain every command and every symbol and every thing that is typed. So here we have four
different batch files. If you have no experience with batching, I suggest you try this tutorial:

I'll just wait here.

Step 1: Color Tester

Picture of Color Tester

Here is the code for testing colors. It's simple and it can be pretty useful.

@echo off
help color
echo ----------------------------------------------------------
echo Type a color code to test colors.
echo To exit, just press the X.
set/p color=
color %color%
goto test

Step 2: Portals

Picture of Portals

In the zip. folder in the last step, I give you a portal that goes to
But here, I will show you a batch file that you can customize to go to multiple websites.
Here it is:

@echo off
color 0a
echo This is the site locater. Choose the # of the site you would like to go to.
echo 1=
echo 2=
echo 3= www.internet
echo 4=
echo 5=
echo 6=
set/p "number=-->"
if %number%==1 GOTO 1
if %number%==2 GOTO 2
if %number%==3 GOTO 3
if %number%==4 GOTO 4
if %number%==5 GOTO 5
if %number%==6 GOTO 6
goto end
goto end
goto end
goto end
goto end
goto end

You may replace the listed websites with any of your own if you want.

Step 3: Guessing Game

Picture of Guessing Game

This is a guessing game I came up with.
I did not take some other guy's guessing game and make some changes.
This one is rather of its own design.

@echo off
color 0b
set/a one's=50
set/a two's=40
set/a three's=30
set/a four's=20
set/a five's=10
set/a six's=5
set/a seven's=1
echo Welcome to this useless two-player game in which one player picks a number
echo between 1 and 100 and the other player tries to guess it. Player 1 makes the
echo number and player 2 tries to guess it. You will be given NO hints or clues.
echo Enter the name for each player.
set/p "pone=Player one>"
set/p "ptwo=Player two>"
goto ar
echo I SAID a number between 1 and 100!
echo OK %ptwo%, look away. %pone%, type in the number and press enter.
set/p "deguess=>"
if %deguess% GTR 100 GOTO busted
echo Choose a difficulty, %ptwo%:
echo (1) piece of cake-50 guesses
echo (2) easy-40 guesses
echo (3) moderate-30 guesses
echo (4) a little tricky-20 guesses
echo (5) hard-10 guesses
echo (6) insane-5 guesses
echo (7) impossible!-1 guess
echo Type the number of the difficulty you would like to play.
set/p "diff=>"
if %diff%==1 GOTO 1
if %diff%==2 GOTO 2
if %diff%==3 GOTO 3
if %diff%==4 GOTO 4
if %diff%==5 GOTO 5
if %diff%==6 GOTO 6
if %diff%==7 GOTO 7
goto br
echo NOPE!
echo Guess in the space below. You still have %one's% guesses.
set/p "guess41=>"
if %guess41%==%deguess% GOTO success
set/a one's=%one's%-1
if %one's%==0 GOTO failure
goto no21
goto cr
echo NOPE!
echo Guess in the space below. You still have %two's% guesses.
set/p "guess42=>"
if %guess42%==%deguess% GOTO success
set/a two's=%two's%-1
if %two's%==0 GOTO failure
goto no22
goto dr
echo NOPE!
echo Guess in the space below. You still have %three's% guesses.
set/p "guess43=>"
if %guess43%==%deguess% GOTO success
set/a three's=%three's%-1
if %three's%==0 GOTO failure
goto no23
goto er
echo NOPE!
echo Guess in the space below. You sill have %four's% guesses.
set/p "guess44=>"
if %guess44%==%deguess% GOTO success
set/a four's=%four's%-1
if %four's%==0 GOTO failure
goto no24
goto fr
echo NOPE!
echo Guess in the space below. You still have %five's% guesses.
set/p "guess45=>"
if %guess45%==%deguess% GOTO success
set/a five's=%five's%-1
if %five's%==0 GOTO failure
goto no25
goto gr
echo NOPE!
echo Guess in the space below. You have %six's% guesses left.
set/p "guess46=>"
if %guess46%==%deguess% GOTO success
set/a six's=%six's%-1
if %six's%==0 GOTO failure
goto no26
echo Guess in the space below. You only have %seven's% guess.
set/p "guess47=>"
if %guess47%==%deguess% GOTO success
goto failure
echo Well done, %ptwo%! You may now exit the game.
color 0c
color 09
color 0e
goto success
echo %pone%'s number was too difficult. Sorry, %ptwo%.
echo The number was %deguess%.

Step 4: Timer

Picture of Timer

A simple timer with a built-in calculator.

@echo off
color 0b
echo Welcome to the timer. This timer only counts seconds.
echo Type in the amount of seconds to count. The number may range from 0 to   
echo 99,999. If you need help converting minutes into seconds, type c for a
echo caculator.
set/p "time=>"
if %time%==c GOTO calc
if %time%==C GOTO calc
if %time% GTR 99999 GOTO bust
echo The time has been set! Press any key to start counting. You can stop the
echo timer by pressing any key. After stoping, the timer cannot continue.
color 0c
timeout %time%
echo (DING!)
goto menu
color 0a
echo Type the math problem below. This calculator doesn't accept decimals,
echo percents, etc. Only whole numbers.
set/p "math=>"
set/a nmath=%math%
echo %math%=%nmath%
echo Would you like to return to the timer or use the calculator again?
echo c or C= calculator
echo t or T= timer
set/p "route=>"
if %route%==c GOTO calc
if %route%==C GOTO calc
if %route%==t GOTO menu
if %route%==T GOTO menu

If anyone knows how, I'd like to know how to make some noise sound out when the timer
goes off. But only for a short time. I don't want to have it go on infinitely, because that would mean restarting the computer every time I use the timer.

Step 5: Download

Picture of Download

Thanks for coming!!!
Here's the download.  

                                                    \ /



예찬최 (author)2016-08-15

you can put like :

start c:\music\"any song.mp3"

at the end

liamw4 (author)2015-12-17

i did it

Batchcc (author)2015-11-11
zaparctimol (author)2015-05-10

Cowzombie123 (author)2014-10-07

Holy. Crap. Thank you for posting the exact code, because I'm an idoit and cant figure this out. You, sir, are the best.

Ink Ninja (author)2013-06-18

I know that it's not exactly a ding, but using Ctrl + G in batch causes a beep of sorts.

lizzyd710 (author)2013-03-28

I think to do that you would have to replace the URLs with the document adress. Like for Windows you would do C:\Users\Person\Desktop\Programs
Thats my best guess.

sam57719 (author)2013-03-22

Type this to make the ding sound (put this after echo (DING!):

rem Making the temp file
if exist temp%num%.vbs goto num
echo ' > "temp%num%.vbs"
echo set speech = Wscript.CreateObject("SAPI.spVoice") >> "temp%num%.vbs"
echo speech.speak "Ding!" >> "temp%num%.vbs"
start temp%num%.vbs
del temp%num%.vbs

sam57719 (author)2013-03-22

if u want to make the ding sound click on the bit where it says ding & press Ctrl + Shift + G

el-xavi26 (author)2012-09-08

Dude you are awesome do you have a youtube account making this ?

KFallen (author)2012-05-25

In the part of the script where it says ding, press Ctrl+Shift+G and it should print a character that says BEL, highlited black. When you run it again, it will sound the system bell. you can also type this into cmd. Depending on the text editor u use, it may show it or not. I use Notepad++. Here is a list of other special commands(if you type them into cmd, most of the print out a character, such as a heart of spade.):

~ Shift + Esc = (ESC)
~ Ctrl + E = (ENQ)
~ Ctrl + R = (DC2)
~ Ctrl + Pause\Break = (ETX)
 ~ Ctrl + Shift + Y = (EM)
~ Ctrl + Shift + W = (ETB)
~ Ctrl + Shift + O = (SI)
~ Ctrl + Shift + A = (SOH)
~ Ctrl + Shift + D = (EOT)
~ Ctrl + Shift + G = (BEL)
~ Ctrl + Shift + H = (BS)
~ Ctrl + Shift + Z = (SUB)
~ Ctrl + Shift + X = (CAN)
~ Ctrl + Shift + C = (ETX)
~ Ctrl + Shift + v = (SYN)
~ Ctrl + Shift + B = (STX)
~ Ctrl + Shift + N = (SO)
~ Ctrl + Shift + 6 + (RS)
~ Ctrl + Shift + -(Dash) = (US)

You may not be able to seem them up here, but the characters look like the ones in parenthesis ieg. (SUB), (BEL)
On some text editors, it they will show up like symbols. Note that these characters cannot be copied and pasted.

nhepworth (author)2012-03-02

if you want to make a sound go off for a timer what you could do is have an audio recording of a DING! sound or whatever. The you could use the START command to start the audio file, then to end the sound i am sure there is a close window command. However, i do not know of it because i have never had to use it. This would make it much more difficult to get off the internet though. You would have to compact the audio file into same folder as the batch file. Possibly you could variate the locker batch file that can be found online. This batch file hides things on the desk top until it is unlocked. You could variate that into your batch file so that it requires no password and only appears for a short time. thus you would be able to call upon an audio file that, in theory, be saved to the desktop.
if you have any questions or need the locker batch file email me at

thillryan (author)2011-12-29


to open the file you cant just put:


you need:

start "C:\test.txt"

or to open a *.bat

call file.bat

hwalker4 (author)2011-09-22

yeah you could easily e.g
@echo off

would open file.txt or..

just typing the file name should work

tinker234 (author)2011-05-30

ok thanks

tinker234 (author)2011-05-22

nice could i use it to acess folders and keep documents

jklujm (author)tinker2342011-05-29

I don't know how, but you probably could.

tinker234 (author)2011-05-22

wow got to do it

About This Instructable




More by jklujm:My Herringbone GearCool Batch FilesBatch Tutorial Using Batch
Add instructable to: