Introduction: Advanced Batch

PLEASE DIRECT ANY QUESTIONS YOU MAY HAVE TO MY BLOG:
http://tamsanh.com/blog/2008/07/11/batch-tutorial-3-advanced-batch/

I do not visit instructables anymore, and you will get a faster response that way.

Hey Guys! Tam Nguyen here. It's been a long time coming, but it's here now! I present to you the next instalment of my Batch Tutorials!

You may (or may not) have read my other instructables:

Basics of Batch
Slightly More Advanded Batch

This Instructable borrows some elements from the first two Instructables. Namely:
ECHO Command
CD Command
DIR Command

If you have not read the other two, I suggest looking over those commands right-quick. I'll wait here.

Ok!

By the end of this Instructable, you will be intimate with:
START Command
SET Command
IF Command
GOTO Command
and
> and >> Parameters

With these commands, you will be able to make dynamic batch files which can change according to user input, and create and expand.

So let's open up that good 'ol Command Prompt and get started!

Run -> cmd

Alternatively, you can go to:

Start->Program Files->Accessories->Command Prompt

My explainations in this instructable got a little long, so I've split up some commands into more than one page mainly for aesthetic purposes; I liked seeing the pictures while reading the text without having to scroll up and down.

Rule of thumb for picture viewing; Usually after every Code Snippet, there is a picture.

Enjoy!

Step 1: START Command

The START Command is a nice little command which starts stuff!

It's a simple command, and will help us warm up before we get to the harder commands.

The parameters of the command are exactly what you think they are.
START ThingToBeStarted.exe
Pretty simple.
START WMPlayer.exe
Not only can you START .exe's, you can also type a website in, and it will open up in your default browser!
START www.Instructables.com
Pretty easy, eh? Ok. Now let's move on to the real meat of the Instructable: SET Command.

Step 2: SET Command - String Theory (1/4)

The SET Command: The Variable Definer.

Ah. Variables. The developer's ambrosia. Variables are bits of memory which are... err, variable. No IFs ANDs or NOTs about it! (lol, sorry). Ok! So how's this baby work?

Very simply, the parameters of the SET command are:

SET VariableName=Variable Value

SET by itself will create string variables.

SET TestVS=Test Variable String!

In this case, we just stored the value "Test Variable String!" into the variable TestVS.
Well that's all fun and games, but how do we retrieve the variable value? We use %.

Just add % around the variable name.

ECHO %TestVS%

Ok cool, but what else can it do?

Step 3: SET Command - Mr.Math (2/4)

Can it do math? Well let's make a simple batch to test it out.

@ECHO OFFSET Test=1ECHO %Test%SET Test=%Test%-1ECHO %Test%PAUSE

Aww, what happened? That should have worked! Wait a minute... what was that about SET commands only making strings?

Yes. The SET command by itself will only create a string variable, meaning it will create the most literal interpretation of the value.
It doesn't think of "1 - 1" equaling "0", it thinks of "1 - 1" equaling "1 - 1."
So how do we change that?

We want the variable not to be directly copied, but Evaluated. This means we want to turn it from a string into an expression! A very easy change, simply add a /a to the SET command.

Here's a simple batch file to see it in action, or you can just type it into the Command Prompt manual. I suggest the latter; it's much faster, and the code isn't too complicated, but if you really want the batch file, here it is:

@ECHO OFFSET /a Test=2+2ECHO %Test%PAUSE

Fantastic! It expressed it perfectly. Now we know what changes need to be made to our 'math test.bat'

@ECHO OFFSET /a Test=1ECHO %Test%SET /a Test=%Test%-1ECHO %Test%PAUSE

Ok. So let's run it!

Great! It worked perfectly! But what next?

Step 4: SET Command - User Input (3/4)

The SET also has the ability to prompt the user for input.

By adding /p to the SET parameters, it transforms it from a normal variable setter to a user-controlled variable setter.

SET /p UDefine=

With the /p, the program actually pauses, and waits for the User's input.

But wait, I don't see a /a parameter, does that mean that the variable is a string only?

Well, sort of. The /p of the parameters completely negates the /a, and if you attempt it, you simply get a Missing operand error. This means that the User Defined variable will not be able to evaluate expressions.

So what can one do?

Well, here's a tricky trick that I thought of that we can use.
The SET Command does not all the simultaneous use of parameters /p and /a, correct? Well, what about the sequential use of the parameters /a and /p?
Ahhh... you sly boots.

@ECHO OFFECHO Calculator Version 1.0ECHO.SET /p UDefine=SET /a UDefine=%UDefine%ECHO =ECHO %UDefine%ECHO.PAUSE

Nice calculator ya got there. If you haven't figured it out by now, the {{{ECHO.}}} is a blank line.

Isn't that cool-cool?

Step 5: SET Command - More Than Meets the Eye (4/4)

At this point, it may seem that the variables of the SET command is only good for strings, and expressions. Not true. The variables are, in fact, very very flexible, and are not just limited to ECHOs.

Have you tried just typing a variable by itself?

SET Test=Instructables%Test%

What a weird error... it says that the command "Instructables" is not recognized, not that %Test% had no syntax. So that means that DOS treats each variable like it was typed by hand. Well, what if...

SET Test=START cmd.exe%Test%

Awesome! It worked!

DOS treats each variable like it was typed by the user, and runs it accordingly. Here's an interesting code: (Just Copy/Paste; it's a bit tedious.)

@ECHO OffSET Variable1=ECSET Variable2=HSET Variable3=O CSET Variable4=ooSET Variable5=l!ECHO %Variable1%%Variable2%%Variable3%%Variable4%%Variable5%ECHO.%Variable1%%Variable2%%Variable3%%Variable4%%Variable5%Pause

Isn't that neat? Each variable contains two letters of the entire message (except Variable2), and putting the variables in order, each letter adds up, and finishes the entire command of ECHO Cool!

The SET command is one of the more complicated, and powerful commands of the DOS dictionary.

Step 6: IF Command - Everyone Is Equal (1/2)

That classic conditional operand. Basic, but powerful none-the-less.

For those who have never programmed before, the IF command is exactly how it sounds. If an expression in the syntax proves true (or NOT true) then the very next sequence of commands will carry out.

The basic command line goes like this:

IF %variable1%==%variable2% ECHO This part is executed
or if you have more than one syntax.
@ECHO OFFIF %variable1%==%variable2% (ECHO This part is executed.ECHO So is this.) ELSE (ECHO If variable1 doesn't = variable 2, this happens.ECHO and this happens too.)

Note: The peculiar placing of parenthesis is not because I don't believe in organized code, but because if they're not in those places, the whole IF snippet will not work. Thus, if there Is any error with your IF code, it's most likely because of the parenthesis.

To run this particular batch, I actually used the Command Prompt itself, so that I could set the variables without having to edit the IfVariableTest.bat multiple times.

Step 7: IF Command - But I'm Greater Than You (2/2)

Ok, so you've got a nice IF statement and all, and checking whether variables are equal or not is nice and all, but doesn't quite fit the bill. I want something to happen if variable1 is less than the other variable!

For those of us programmers, I know this seems like a simple task. Just do what all the other programming languages do!

Well hold your horses cowboy. Not so fast. A Batch file isn't just your regular ol' programming langage. Silly as it may seem, the "<" and ">" don't work with Batch files.
EQU - Equal - ==NEQ - Not EqualLSS - Less ThanGTR - Greater ThanLEQ - Less Than or Equal ToGEQ - Greater Than or Equal To
Just put these operands in place of the ==

Example:
IF 32 GTR 3 ECHO This Will Work
@ECHO OFFIF 32 GEQ 32 (ECHO 32 is Greater Than, or Equal to 32) ELSE (ECHO 32 is definitely Equal to 32)PAUSEIF 32 LSS 32 (ECHO 32 is Less Than 32? I think not.) ELSE (ECHO 32 is Not Less Than 32. End of story.)PAUSE

Step 8: GOTO Command

The GOTO Command. It does exactly what it says; it GOes TO a label in the batch file script.

To use this command, you must first have a label in place. Labels look like this:
:Label1
It's simply a colon before a non-spaced series of letters and/or numbers.

The GOTO command is structured like this:
GOTO Label1
It's That Easy!
Come to think of it, I'm not really sure why I didn't put this in the Slightly Advanced Batch.

In any case, this command can be used to repeat a batch file by simply GOTO a label that executes the GOTO command again.

@ECHO OFF:RepeatMeECHO This will be repeated unless you hit "CTRL-C"GOTO RepeatMe
The batch file speaks the truth, by the way. CTRL-C is the universal Pause and Prompt for Termination. CTRL-S is simply Pause. But Closing the window works just as well.

The GOTO can skip, or reorder your code as well.
GOTO TurnEOffGOTO MultipleGotoECHO This ECHO is going to be skipped.:MultipleGotoGOTO 3:ENDPAUSEEXIT:1ECHO The EndGOTO END:3ECHO This will be displayed firstGOTO 2:TurnEOff@ECHO OFFGOTO MultipleGoto:2ECHO This is second, even though it&apos;s last in the code.GOTO 1
The above code was structured confusingly on purpose to emphasize the GOTO's ability to jump around in the code.

Step 9: > Parameter (1/2)

This next bit isn't really a 'command,' but rather an added syntax into other commands. What it does is it takes the Output of a certain command, and can write it into a Text file. It's easier to explain if you see it in action first.
Its syntax is:
Command>Filename
Ok, so let's say we're in a certain directory. We then use the DIR Command, which, if you read the Basics of Batch, you would know as showing the contents of your current directory.
C:\Users\Neo\>DIR
Would normally output:
 Volume in drive C is HP Volume Serial Number is BC7E-E26C Directory of C:\Users\Neo06/30/2007  11:14 AM    <DIR>          .06/30/2007  11:14 AM    <DIR>          ..03/17/2007  06:41 PM    <DIR>          .idlerc02/19/2007  03:14 PM    <DIR>          Contacts06/19/2007  10:44 PM    <DIR>          Desktop06/29/2007  08:47 AM    <DIR>          Documents06/19/2007  10:35 AM    <DIR>          Downloads02/19/2007  03:14 PM    <DIR>          Favorites02/19/2007  03:14 PM    <DIR>          Links05/12/2007  04:01 PM    <DIR>          Music06/30/2007  01:20 AM    <DIR>          Pictures04/07/2007  03:08 PM    <DIR>          Saved Games02/19/2007  03:14 PM    <DIR>          Searches03/01/2007  07:23 PM           242,947 Test Record.wma06/19/2007  10:39 AM    <DIR>          Videos06/18/2007  09:57 AM         1,324,574 wp_screenprint_mc.pdf06/18/2007  09:59 AM        73,996,533 wp_tshirt_full.mp4               4 File(s)     75,564,054 bytes              14 Dir(s)  132,927,537,152 bytes free
But, if we add the > and to it...
C:\Users\Neo\DIR>DIRContents.txt
We don't get an output, but instead, we get a brand-spankin'-new Text File named DIRContents.txt which has the Output in it! Coolness!

But wait, there's a problem! I want to have multiple outputs in the same file, but my > just keeps overwriting it, and not adding it! What do I do?

Step 10: >> Parameter (2/2)

Well I'm glad you asked. That's what the >> Parameter is for!

The >> is just like the >, but instead of completely overwriting the specified file, we Add to it!

So let's try it.
DIR>>DIRContents.txt
Neat! Worked Perfectly! So wait. Does that mean that I can write anything I want into a text file? I want to try it!
Batch Is Awesome>Awesome.txt
What? Why didn't that work? It's because the parameter only writes the output of Legitimate Commands, not just anything you type in. But, this is a problem that is simply solved. Remember, the parameters record the Output of Commands. What command has an output that we can control?

Right! The ECHO Command!
ECHO Batch Is Awesome>Awesome.txtECHO I&apos;m so glad that I know it.>>Awesome.txt
Yay! Remember. The >> adds the Output to the very next line of the file.

Step 11: Example Implementation

Ok. So let's put it all together! Here are some sample codes I've made that use the commands I've shown you in this instructable.

This code will add 1 to a variable continually, and output the result indefinitely.
@ECHO OFFSET /a num=1:RepeatECHO %num%SET /a num=%num%+1GOTO Repeat

This code will start CMD.exe 5 times.
@ECHO OFFSET /a RepeatNum=5:OpenIF %RepeatNum%==0 GOTO EndSTART CMD.exeSET /a RepeatNum=%RepeatNum%-1GOTO Open:End

This code will create a batch file in the C:\Users\Neo, and will run it.
@ECHO OFFCHDIR C:\Users\NeoECHO @ECHO OFF>Hello.batECHO ECHO Hello!>>Hello.batECHO ECHO I&apos;m in your C Drive!>>Hello.batECHO PAUSE>>Hello.batC:\Users\Neo\Hello.batPause

This is a little game batch. You must guess the number.
@ECHO OFFSET /a GuessNum=0SET /a Answer=%RANDOM%ECHO Guess what Number I&apos;m thinking of.:RetrySET /p Guess=IF %Guess% LSS %Answer% ECHO My Number is Higher.IF %Guess% GTR %Answer% ECHO My Number is Lower.IF %Guess%==%Answer% GOTO ENDECHO.SET /a GuessNum=%GuessNum%+1GOTO Retry:ENDECHO You are Correct! The Answer was %Answer%ECHO It took %GuessNum% Guesses.ECHO.PAUSE
And this one, I like a lot. If you're not careful, however, it can get out of hand fairly quickly, depending on your computer's ability. What this file does is it indefinitely creates numbered text files in a directory called lolnumbers. Each of these text files contains the DIR of the lolnumbers directory. The thing is, the directory is constantly getting fuller and fuller with text files, so each consecutive text file is larger than the last. The result of this is a folder whose total size gets larger and larger every second.
@ECHO OFFSET /a num=1MKDIR lolnumbersCD lolnumbers:RestartDIR>%num%.txtSET /a num+=1GOTO Restart

These are pretty basic codes. Experiment with them to your heart's content.

Step 12: Conclusion: Final Notes

Phew. We covered a heck of a lot in this instructable. This one is, infact, 3 times longer than my last one. I hope ya'll enjoyed it!

Just a few reminders before I go.

Remember:
When SETing a variable, Never put a space between the variable and its value.

YES:
SET variable1=Value
The extra space will cause your variable to be blank.

NO:
SET variable1 = Value

Also, the multiple IFs. Remember to format the Parenthesis properly:

YES:
IF 1==1 (ECHO One Equals One!) ELSE (ECHO Something&apos;s wrong with this program.)

NO:
IF 1==1(ECHO One Equals One!)ELSE(ECHO Something&apos;s wrong with this program.)

Also, there are built-in variables as well.
%CD%%DATE%%TIME%%RANDOM%
%CD% Expands to the current directory. Basically, the path behind the first >
%DATE% and %TIME% are the Date and Time.
%RANDOM% gives a random number between 0 and 32767. The range cannot be changed, I don't think.

And that's basically it! I hope you enjoyed this instructable, I worked really hard on it.

Hopefully, it will make up for the 10 Month Absence.

Now the bad news. I will have a bit of trouble answering any questions in the next few months, because I will be out of Country. But if you do have a question, just leave a comment anyone. If I do get access to a computer, I'll be sure to answer, but I don't think that will be necessary; Instructables is a friendly community, and I'm Sure that someone out there will help you in your plight.

Happy Batching!

Comments

author
HirushaHeshan (author)2017-04-20

I Made This Batch Calculator. Can Someone Develop it ???

:: Batch Calculator

@echo off

title Batch Calculator

color a

echo Welecome To Batch Calculator

echo ============================

:a

echo.

echo.

echo + = Add

echo - = Subtract

echo / = Division

echo * = Multiple

echo.

echo.

echo Type Your Calculation

echo.

set /p ui=

if %ui%==About (goto ab)

set /a ui=%ui%

echo.

echo Answer is %ui%

pause

:b

cls

echo Next Calculation ? (Y/N)

set /p nxt=

if %nxt%==y (goto a)

if %nxt%==Y (goto a)

if %nxt%==n (goto end)

if %nxt%==N (goto end)

echo Invalid Choice

goto b

:end

echo Thanks For Using Batch Calculator

Pause

exit

:ab

echo =====+Batch Calculator+=====

echo =====+Developed By HRS+=====

pause

cls

goto a

:: Developed By </HRS>

author
phoenix701 (author)2016-11-12

it is too dificult to understand the previoius ones are better

author
chetsNydu (author)2016-10-22

Please help me with below requirement . I need to remove last blank line from the CSV file . I need it on Urgent basis. Please help me ..

author
jack5050 (author)2016-03-17

NOBODY HERE?

author
jack5050 (author)2016-03-17

THANK YOU M.R TECTECHNICALGUY

author
TehTechnicalGuy (author)2012-06-18
Hem hem. Here it is an animation box, thank you.
@echo off
setlocal enabledelayedexpansion
set Counter=0
set Schalter=2
set Width=0


:: The weird symbols are replaced by lines in the CMD-window
:: All options that are marked by a little point are finite
:: --- All the others are unfinite, the program has to be closed by X to
:: view another animation
:: --- "c4: Star Wars" is not infinite, but it takes quite a lot time

:Start
call :ResetVariables
title Animation Box
mode con cols=80 lines=25
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo ºú1: Installation ³ú 9: Arrow left ºúc1: 1min º
echo º 2: Slow loading ³ú10: Arrow right ºúc2: 2009 º
echo º 3: Fast loading ³ 11: Skull º c3: Bat disco º
echo º 4: Big loading ³ú12: Dos Techno Virusº c4: Star Wars º
echo ÌÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÎÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĹ
echo º 5: Matrix ³ú13: Winhound ºúm1: Matrix part 1 º
echo º 6: Epilepsy ³ú14: Expand window ºúm2: Matrix part 2 º
echo ºú7: Naked woman ³ ºúm3: Matrix part 3 º
echo º 8: Fill window ³ ºúm4: Matrix part 4 º
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÊÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
set /p choice=--^>
cls
if "%choice%" == "5" set Schalter=
call :%choice%
goto :Start






:: "Counter" is the amount of finished %, yet (at last 100%)
:: "Display" is the progress bar
:: --- This bar consists of the half of the %-amount (at last 50)
:: --- The bar moves from left to right

:1
title Animation Box - Installation
set /a Counter=%Counter% + 1
set /a Display=%Counter% / 2
FOR /L %%A IN (1,1,%Display%) DO (
set Display=!Display!²
)
cls
echo New files are copied... %Counter%%%
echo ²!Display:~2,47!
ping localhost -n 1 >nul
if "%Counter%" == "100" goto :1-End
goto :1
:1-End
echo.
echo Installation complete.
pause >nul
EXIT /B




:2
cls
title Animation Box - Slow loading
echo Opening file.
echo.
echo I I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I² I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I ² I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I² ² I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I ² ² I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I² ² ² I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I ² ² ² I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I ² ² ² I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I ² ² ² I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I ² ² ² I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I ² ² ² I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I ² ² ² I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I ² ² ² I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I ² ² ²I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I ² ² I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I ² ²I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I ² I
ping localhost -n 1 >nul
cls
echo Opening file.
echo.
echo I ²I
ping localhost -n 1 >nul
cls
goto :2



:: "Counter" determines the length of the row
:: "Display" is the row
:: "Schalter 1" = From left to right
:: "Schalter 2" = From right to left

:3
title Animation Box - Fast loading
cls
echo [!Display!]
set Display=
if "%Counter%" == "0" set Schalter=1
if "!Schalter!" == "1" set /a Counter=%Counter% + 1
if "%Counter%" == "41" set Schalter=2
if "!Schalter!" == "2" set /a Counter=%Counter% - 1
if "!Schalter!" == "1" FOR /L %%A IN (1,1,%Counter%) DO set Display=!Display!±
if "!Schalter!" == "1" FOR /L %%A IN (%Counter%,1,40) DO set Display=!Display!
if "!Schalter!" == "2" FOR /L %%A IN (1,1,%Counter%) DO set Display=!Display!
if "!Schalter!" == "2" FOR /L %%A IN (%Counter%,1,40) DO set Display=!Display!±
goto :3









:: The subpoint "4_DisplaySpace" is used to compress the animation's size in the file.
:: The FOR-part in the middle of the animation is used for the same reason.
:: --- It counts the amount of spaces between the left stars and the loadbar, and
:: between the right stars and the loadbar.
:: --- There are at last 65 spaces.
:: --- The entire animation counts 79 columns. The loadbar is 11 columns wide.
:: From the left 68 columns, 2 are the stars at the left and the right.
:: 66 columns left, 65 of them spaces (79 - 11 - 2 = 66)

:: The variable "line" is used to compress the animation's size in the file, too.

:4
title Animation Box - Big loading
mode con lines=15
goto :4_DisplayBars

:4_DisplaySpace
echo *******************************************************************************
ping localhost -n 1 >nul
cls
echo.
echo.
echo.
echo.
echo *******************************************************************************
exit /b

:4_DisplayBars
call :4_DisplaySpace
echo * *
echo * *
echo * *
call :4_DisplaySpace
echo *8 *
echo *8 *
echo *8 *
call :4_DisplaySpace
echo *88 *
echo *88 *
echo *88 *
call :4_DisplaySpace
echo *888 *
echo *888 *
echo *888 *
call :4_DisplaySpace
echo * 888 *
echo * 888 *
echo * 888 *
call :4_DisplaySpace
echo *8 888 *
echo *8 888 *
echo *8 888 *
call :4_DisplaySpace
echo *88 888 *
echo *88 888 *
echo *88 888 *
call :4_DisplaySpace
echo *888 888 *
echo *888 888 *
echo *888 888 *
call :4_DisplaySpace
echo * 888 888 *
echo * 888 888 *
echo * 888 888 *
call :4_DisplaySpace
echo *8 888 888 *
echo *8 888 888 *
echo *8 888 888 *
call :4_DisplaySpace
echo *88 888 888 *
echo *88 888 888 *
echo *88 888 888 *
call :4_DisplaySpace
FOR /L %%A IN (0,1,66) DO (
set Length=
set Width=
FOR /L %%D IN (1,1,%%A) DO set Length=!Length!
FOR /L %%E IN (%%A,1,65) DO set Width=!Width!
set Line=*!Length!888 888 888!Width!*
FOR /L %%R IN (1,1,3) DO echo !Line!
call :4_DisplaySpace
)
echo * 888 888 88*
echo * 888 888 88*
echo * 888 888 88*
call :4_DisplaySpace
echo * 888 888 8*
echo * 888 888 8*
echo * 888 888 8*
call :4_DisplaySpace
echo * 888 888 *
echo * 888 888 *
echo * 888 888 *
call :4_DisplaySpace
echo * 888 888*
echo * 888 888*
echo * 888 888*
call :4_DisplaySpace
echo * 888 88*
echo * 888 88*
echo * 888 88*
call :4_DisplaySpace
echo * 888 8*
echo * 888 8*
echo * 888 8*
call :4_DisplaySpace
echo * 888 *
echo * 888 *
echo * 888 *
call :4_DisplaySpace
echo * 888*
echo * 888*
echo * 888*
call :4_DisplaySpace
echo * 88*
echo * 88*
echo * 88*
call :4_DisplaySpace
echo * 8*
echo * 8*
echo * 8*
goto :4_DisplayBars










:: Matrix effect coming from below
::
:: If "Schalter" equals a space (" "), then the figures are moved one space to the right
:: If "Schalter" equals nothing (""), then the figures aren't moved.
::
:: %%A equals the last line, yet (the one at the top)
:: %%B equals the new line (%%A moved one line towards the top)
:: --- %%B equals the last %%A
::
:: In the last FOR-command, all lines are displayed. In case if the screen isn't filled, yet,
:: the program will put a blank (echo.)

:5
title Animation Box - Matrix
color 0a
ping localhost -n 1 >nul
cls
if "%Schalter%" == "" (set Schalter= ) ELSE (set Schalter=)
FOR /L %%A IN (1,1,23) DO (
set /a B=%%A + 1
FOR %%B IN (!B!) DO set Line%%A=!Line%%B!
)
set Line24=%Schalter%%random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1% %random:~0,1%
FOR /L %%A IN (1,1,24) DO if defined Line%%A (echo !Line%%A!) ELSE (echo.)
goto :5






:: Flickering CMD-window in "white-black" "black-white" (background-font)

:6
title Animation Box - Epilepsy
ping localhost -n 1 >nul
cls
if "%color%" == "0f" (set color=f0) ELSE (set color=0f)
color %color%
FOR /L %%A IN (1,1,9) DO echo.
echo 88888888 88 88 88 88
echo 88 88 88 88 88
echo 88 888888 88
echo 88 88 88888888 888888 88 888888 888888 88 888888
echo 88 88 88 88 88 88__88 88 88 88 88 88 88 88__88
echo 88 88 88 88 88 88____ 888888 888888 888888 88 88____
FOR /L %%A IN (1,1,8) DO echo.
goto :6









:7
title Animation Box - Naked woman
color 05
mode con lines=180
echo .,,,,,..
echo _.zJ??c,J$hhhhh:::::??c,
echo ,J?:::::J99?????h::?h:::::?h
echo z”::::::$9999??h::::??h:?h:::?$.
echo J:::J$?::6;hh:::::??i:::?h::$::::$
echo J::9F::hhh6T??h:??h:::?$:::?h::$:::$
echo J::9?h?:::$:?$C:??h:??h:::9h::?h:?$::$
echo ;F:JF9?:J?:$h::?h:::?h::?h::?h::?$::h::h
echo $::C:CjF:j?$9h::?h:::?h:::9h::?h::$::9:9?
echo $:$:$9?:C9?$:$:::?h::::$:::?h:::$::$::$:$.
echo CJ?9:C:$:$:9::$:::?h::::?h:::$:::$::9::$:$
echo $$:$J:9:9J$:$::$:::?h::::?h:::?h::$::$:?h:,
echo C:F$:9:$$’”?$::$:::?h::::?h:::?h::$::h:?:9
echo :9:C::C?$’.`.$::h:::?h::::9::::$::9::?h:::
echo J:$:C::$:$’.`.`”"”?:::?h::::$::::$::$::$:::$
echo $:9:C:::$’`.`.`.`.“hjj?h::::$:::?h::h::::$
echo $:9::::hc?Jccc`.`.`.`z$??h:::h:::$::9::9::9
echo ?:9:9:::i’,cccJ”`.`.`J’Plcc$h::::::$:?C:::9
echo $:C:$:9'J$?$$$FP’.`jF3F`$$$ 3?h::::?:h::$:J
echo :$::$”‘”?c?$CJ`.`.$’.`?+??”`.`h::::$::X:::
echo h?C:9`.`.`.`.`.`.`$’.`.`.`.`.“h:::9h:C:::
echo `h$:9`.`.`.`.`.`.`??`.`.`.`.`.`?h:::C:C:J
echo `hh?h.`.`.`.`.`.`.`L’`.`.`.`.`.3::hC:F:F
echo 3:$$,`.`.`.`.`.`;3`.`.`.`.`.:C:9:9:$
echo ?h:?c`.`.`.`”"??”`.`.`.`.`.`.3::$:$:F
echo ??h`.`.`.`.`.`.`.`.`.`.`.`.$??:$:P
echo ?,.`.`.cJ?????QI$?.`.`.`.$::$:$
echo $,`.`.3?hc,c??$’`.`.`.`$:::P
echo $9,.`.`?hCCCJ”`.`.`.`.z?9:J”
echo ?h?h`.`.`.`.`.`.`.`.,$;;;,
echo ”"?,`.`.`.`.`.`.,$?;;;;9.
echo ?i.`.`.`.`.,J?;;;;;;;?c_
echo $h,.`.`,cc?;;;;;;;;;;;;?c,
echo $;;???;;;;;;;;;;;;;;;;;;;;?hc,
echo 3;;;;;;’`.`.`.`.`.`;;;;;;;;;;;???hhhccc,,_
echo ;;;;’`.`.`.`.`.`.`;;;;;;;;;;;’.`.`.`.`.`”?h .
echo ;;;’.`.`.`.`.`.`;;;;;’.`.`.`.`.`;;;’.`.`.`.`?
echo $;;’`.`.;.`.,;;;;;’.`.`.`.`.,;;;;;’.`.`.`.`.`.
echo C;;’`.`,;;;;;;;’`.`.`.,;;;;;;’`.`.`.`.`.`.`.`.
echo ,$?;;’`.`;;;;;’.`.`.`;;;;;’.`.`.`.`.`.`.`.`.`.`.
echo ,,cJ??;$;;;’`.;;’.`.`.`,;;;;’.`.`.`.`.`.`.`.`.`.`.`.`.
echo ,=”`.`.;;;;;;’.`.;;’.`.`,;;;;’.`.`.`.`.`.`.`.`.`.`.`.`.`.
echo ,P’`.`.`.`.`.`.`.`.;;;;;;;;’.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.
echo ,P’`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.
echo J”`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.
echo J’.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.
echo F`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.
echo F`.`.`?`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.
echo $’.`,J.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`ccc,.`.`.
echo $’.`J’.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`;;;;;;;?$,.`.
echo ?`.;F`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.;;;;;;;;;;?i`.
echo `L.P’`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.;;;;;;;;;;;?h.
echo hP’.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`:;;;;;;;;;;;;;$
echo P’`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`;;;;;;;;;;;;;$’
echo ,P’.`.`.`.`.`.`.`.`.;;`.`.`.`.`.`.`.`.`.`.`.`.`.`j;;;;;;;;;;;”
echo ,P’`.`.`.`.`.`.`.`.`;;;:’`.`.`.`.`.`.`.`.`.`.`.`.`;;;;;;;;;;F
echo J”`.`.`.`.`.`.`.`.`.;;;;:’`.`.`.`.`.`.`.`.`.`.`.`.`3;;;;;;;;;$
echo d’.`.`.`.`.`.`.`.`.`.;;;;:’`.,J??hc`.`.`.`.`.`.`.`.`9;;;;;;;;;F
echo d?h.`.`.`.`.`.`.`.`.`;;9;;:’`;$;jj;?h.`.`.`.`.`.`.`.;$;;;;;;;;9'
echo Jj;9,`.`.`.`.`.`.`.`.`;j$;;’.`3CJ;$;;$.`.`.`.`.`.`.;C;;;;;;;;$
echo C$;9'`.`.`.`.`.`.`.`.;3C;;’.`?C;T;;;$’.`.`.`.`.`.`.;j;;;;;;;;F
echo ?;;$.`.`.`.`.`.`.`..;;;3C;;’.`.?hjjUP’.`.`.`.`.`.`.;;3;;;;;;;;$
echo ?9F;’.`.`.`.`.`.`.;;j;9C;;’.`.`.`.`.`.`.`.`.`.`.`;;;F;;;;;;;;;
echo h;;;.`.`.`.`.`..;;;$`;h;;;’`.`.`.`.`.`.`.`.`.`.;;;F;;;;;;;;$
echo $;;;;.`.`.`.,;;;;9':;9;;;;`.`.`.`.`.`.`.`.`.;;;;F;;;;;’.`;F
echo $;;;;,.`.`;;;;;9F`.;;$;;;;,`.`.`.`.`.`.,;;;;j$;;’`.`.`.`$
echo ?;;;;;;;;;;;;JF.`.;;;?h;;;;;;;;;;;;;;;;;;j?;;;`.`.`.`.,F
echo ?;;;;;;;;;$”`.`.`;;;;$i;;;;;;;;;;;;;jj??;;;.`.`.`.“J
echo `?h;;;;J?`.`.`.`.`;;;;???Jjjjjjjj??;;;;`.`.`.`.`.“F
echo ”3?‘`.`.`.`.;;’.`.`.;;;;;;;;;;;;’.`.`.`.`.`.`.`;F
echo 3`.`.`.`.`.;;’.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`$’
echo 3`.`.`.`.`.;;’.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.,F
echo ?`.`.`.`.`.;;’.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.$’
echo `h.`.`.`.`.;;’.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.F
echo h.`.`.`.`.;;;.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`3'
echo $.`.`.`.`.;;;’`.`.`.`.`.`.`.`.`.`.`.`.`.`.`$
echo $.`.`.`.`.;;;’`.`.`.`.`.`.`.`.`.`.`.`.`.`.,F
echo .F.`.`.`.`.`;’.`.`.`.`.`.`.`.`.`.`.`.`.`.`.3'
echo j`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.3
echo F`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`,;cc????ci,3,
echo J.`.`.`.`.`.`.`.`.`.`.`.`.`.`.,J?`.`.`.`.`.`.?L
echo J’.`.`.`.`.`.`.`.`.`.`.`.`.`.`3?`.`.`__…`.`.`?c
echo .,jF`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.?c??”"“”"h,.` .`.??
echo .F’`h`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.uc??????.`.`.`?h
echo F`.$’.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`zP’.`.`.`.`.`.`.`.`?c
echo 3?`$’.`.`.`.`.`.`.`.`.`.`.`.`.`.c=”`.`.`.`.`.`.`.`.`.`.`?c_,
echo J?’”‘”.`.`.`.`.`.`.`$h.`.`.`.`.`.J?`.`._uc=”"” `.`.`.`.`.`.`.`.`.
echo ?`.`3?.`.`.`.`.`.`.`$$:`.`.`.`.`?h_.,;P”`.`.`.`.`.`.`.`.`.`.`.`.`
echo $’.`?,`.`.`.`.`.`.:$$’`.`.`.`.`.`;P”`.`.`.`.`._,zJ?`.`.`.`.`.`.`
echo J??$’.`h`.`.`.`.`.`.`?P’`.`.`.`.`.`$’.`.,,ccc+?”"`.`.`.`.`.`.`.`.`
echo $’.`?J?.`.`.`.`.`.`.`.`.`.`.`.`.`.`.”=”3?`.`.`.`.`.`.`.`. `.`.`.`.
echo .$i`.`h.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`??`.`.`.,uc”"cu,_.`.`.` .`.
echo $’??”"`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`”????”`.`.` .`.`?h_`.`.`.
echo h`.3,.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`”??$P
echo `?cP’.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.?,
echo C`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`h
echo C`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`3,
echo F`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.“h
echo F`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.$
echo F`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.3,
echo h`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`h
echo h`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`$
echo $’.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`,/.`.`.`.`.`.`.`.`.`.`.`.`3
echo $’.`.`.`.`.\.`.`.`.`.`.`.`.`.`.`.`.j”`.`.`.`.`.`.`.`.`.`.`.`.`?
echo $’.`.`.`.`.`?,.`.`.`.`,,,;;;;;;;;;J’.`.`.`.`.`.`.`.`.`.`.`.`.`.
echo 3`.`.`.`.`.`.?’;;;;;;;;;;;;;;;;;;J’`.`.`.`.`.`.`.`.`.`.`.`.`.`.
echo 3`.`.`.`.`.`.`?;;;;;;;;;;;;;;;;;$’.`.`.`.`.`.`.`.`.`.`.`.`.`.`,
echo ?`.`.`.`.`.`.`.?;;;;;;;;;;;;;;;P’`.`.`.`.`.`.`.`.`.`.`.`.`.`.`j
echo ?,.`.`.`.`.`.`.`?;;;;;;;;;;;;j?`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`3
echo `h.`.`.`.`.`.`.`.L;;;;;;;;;;J’.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`$
echo $’`.`.`.`.`.`.`.`L;;;;;;;;J’`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`$
echo $’`.`.`.`.`.`.`.`.$;;;;;;;F.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`$
echo $’`.`.`.`.`.`.`.`.`?L;;;;P’.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.,F
echo $’`.`.`.`.`.`.`.`.`.`?L;$’`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.$’
echo 3.`.`.`.`.`.`.`.`.`.`.`?F.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`,F
echo ?.`.`.`.`.`.`.`.`.`.`.,F`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`$’
echo `h`.`.`.`.`.`.`.`.`.`,P’`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`$
echo h`.`.`.`.`.`.`.`.`.`J`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`F
echo $’.`.`.`.`.`.`.`.`.,P’.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.,F
echo ?`.`.`.`.`.`.`.`.`.J.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.j’
echo `h.`.`.`.`.`.`.`.`.F.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.$
echo h.`.`.`.`.`.`.`.`,F.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`.`
echo.
pause >nul
color 07
exit /b









:: "Counter" determines the heigth of the last row (no matter if from below or above)
:: "Width" determines the width of each line (from left to right)
:: "Line%%A" are the lines 1 to 24, undepending from their length or width
:: "Schalter1" = From above to below
:: "Schalter2" = From below to above

:: :: ----Line1-------------------------------------
:: :: -C--Line2----------W-i-d-t-h------------------
:: :: -o--Line3-------------------------------------
:: :: -u--Line4---------|---------Schalter 2--------
:: :: -n--Line5---------|---------------------------
:: :: -t--Line...-------V-------------A-------------
:: :: -e--Line23----------------------|-------------
:: :: -r--Line24----Schalter 1--------|-------------
:: :: ----Line25------------------------------------

:8
title Animation Box - Fill window
cls
if "%Counter%" == "0" (
set Schalter=1
set /a Width=!Width! + 1
)
if "!Schalter!" == "1" set /a Counter=%Counter% + 1
if "%Counter%" == "25" (
set Schalter=2
set /a Width=!Width! + 1
)
if "!Schalter!" == "2" set /a Counter=%Counter% - 1
if "!Schalter!" == "1" FOR /L %%A IN (1,1,%Counter%) DO set Line%%A=
if "!Schalter!" == "1" FOR /L %%A IN (1,1,%Counter%) DO FOR /L %%B IN (1,1,!Width!) DO set Line%%A=!Line%%A!±
if "!Schalter!" == "2" FOR /L %%A IN (24,-1,%Counter%) DO set Line%%A=
if "!Schalter!" == "2" FOR /L %%A IN (24,-1,%Counter%) DO FOR /L %%B IN (1,1,!Width!) DO set Line%%A=!Line%%A!±
FOR /L %%A IN (1,1,24) DO if defined Line%%A echo !Line%%A!
ping localhost -n 1 >nul
goto :8











:9
title Animation Box - Arrow left
mode con lines=25
echo.
echo.
echo.
echo.
echo 8888
echo 8888
echo 8888
echo 8888
echo 8888
echo 8888
echo 8888888888888888888888888888888888888888888888
echo _88888888888888888888888888888888888888888888888
echo 88888888888888888888888888888888888888888888888
echo 8888888888888888888888888888888888888888888888
echo 8888
echo 8888
echo 8888
echo 8888
echo 8888
echo 8888
pause >nul
exit /b





:10
title Animation Box - Arrow right
mode con lines=25
echo.
echo.
echo.
echo.
echo 8888
echo 8888
echo 8888
echo 8888
echo 8888
echo 8888
echo 8888888888888888888888888888888888888888888888
echo 88888888888888888888888888888888888888888888888_
echo 88888888888888888888888888888888888888888888888
echo 8888888888888888888888888888888888888888888888
echo 8888
echo 8888
echo 8888
echo 8888
echo 8888
echo 8888
pause >nul
exit /b








:: Blinking skull in "black-red" "darkred-grey" (background-font)

:11
title Animation Box - Skull
mode con lines=54
echo.
echo _________ _________
echo / \ / \
echo / \ / \
echo I OOO I I OOO I
echo I OOO I I OOO I
echo \ / \ /
echo \__ __/ \__ __/
echo \ \ / /
echo \ \ ___________________ / /
echo \ \ _/ \_ / /
echo \ \ _/ \_ / /
echo \ \ _/ \_ / /
echo \ / ,adPba, ,adPba, \ /
echo \ / a8"""""8a a8"""""8a \ /
echo \/ Y8888888Y Y8888888Y \/
echo / \@@@@@@@/ \@@@@@@@/ \
echo I @@@@@ @@@@@ I
echo I ,aAa, I
echo I a"""""a I
echo I 8YYYYY8 I
echo I 9888887 I
echo I @@@@@ I
echo I I
echo \ ___________________ /
echo / \ ² ² / \
echo / \ _____²_________²___ / \
echo / /\_ _/\ \
echo / / \_ _/ \ \
echo / / \_ _/ \ \
echo / / \___________________/ \ \
echo / / \ \
echo __/ (_ _) \__
echo / \ / \
echo / \ / \
echo I OOO I I OOO I
echo I OOO I I OOO I
echo \ / \ /
echo \_________/ \_________/
echo.
echo.
echo 888888 88 88 88
echo 8888888 88 88 88
echo 88 88 88 88 88
echo 88 88 aa88aa 88 88
echo 88 88 YY88PY 88 88
echo 88 88 88888888 88888888 88 88888888 88
echo 88 88 88 88 88PYYY88 88 88888888 88
echo 88 88 88888888 88 88 88 88 88
echo 8888888 88 88aaaa88 88aaaaa 88 88 88
echo 888888 88888888 888888888 88888888 88 88 88

:11_Colour
color 0c
FOR /L %%A IN (1,1,6) DO ping localhost -n 1 >nul
color 47
FOR /L %%A IN (1,1,6) DO ping localhost -n 1 >nul
goto :11_Colour











:: Dos Techno Virus from the MS-DOS-times. It displays "TECHNO" all over again.
:: This animation stops after 25 lines (25 * 80 = 2000)
:: --- 25 = total amount of visible lines in one CMD-window
:: --- 80 = total amount of columns in one CMD-window

:: It sets the variable "M" to the entire code
:: There are 3 spaces between each "TECHNO"

:: When "C" equals 2,3 or 4, "L" is always a space
:: --- Else if "C" equals "0", the next letter is added to "M"
:: --- Either T,E,C,H,N or O (= TECHNO)

:: L = Letter
:: C = Changed
:: M = Message

:12
title Animation Box - Dos Techno Virus
set L=
set M=
set C=0
FOR /L %%A IN (1,1,2000) DO (
if "!C!" == "1" set C=0
if "!C!" == "2" (
set L=
set C=1
)
if "!C!" == "3" (
set L=
set C=2
)
if "!C!" == "4" (
set L=
set C=3
)
if "!C!" == "0" if "!L!" == "N" (
set L=O
set C=4
)
if "!C!" == "0" if "!L!" == "H" (
set L=N
set C=1
)
if "!C!" == "0" if "!L!" == "C" (
set L=H
set C=1
)
if "!C!" == "0" if "!L!" == "E" (
set L=C
set C=1
)
if "!C!" == "0" if "!L!" == "T" (
set L=E
set C=1
)
if "!C!" == "0" if "!L!" == " " (
set L=T
set C=1
)
if "!Cursor!" == "ß" (set Cursor=Ü) ELSE (set Cursor=ß)
set M=!M:~0,-1!!L!!Cursor!
echo !M!
ping localhost -n 1 >nul
cls
)
pause >nul
exit /b







:: Animation of a tiger's head
:: ^ are used to allow | in the animation

:13
title Animation Box - Winhound
color 0c
echo $$$$ $$$$$$'
echo $$$$.$$$ $$$$$$$$.
echo $$$$$$'$$$$$$$$$$$$$$$$$$$$$$$$$
echo $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
echo $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
echo $$$$$$$$$$....0ø)`$$;$$$$$....0ø) , ,
echo $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ / /
echo $$$$$$$$$$_$$$$$$$$$$$$$$$$$$$$$$./ /
echo $$$$$$$$$_$$$$$'$$$$$$$$.$$.$$$`$$./
echo $$$$$$$$$_$$$$$$$'$$$$$.$$$$.$$$`$$---"
echo $$$$$$$$$$_$$$$$$$$$$$$$$____$$$$$$`
echo $$$$$$$$$$$$_$$$$$$$$$$$$$_$$$$$$
echo $$$$$$$$$$$$$$$$___^| /'___^| /$
echo $$$$$$$$$$$$$$_____^| /_____^| /$
echo $$$$$$$$$$$$$__eeee^|/____$$^|/
echo $$$$$$$$$$$$$__,___,____$$
echo $$$$$$$$$$$$$$__,___,____$$
echo $$$$$$$$$$$$ $$___/^|___,__$/^|
echo $$$$$$$$$$$ $$_/ ^|,_____/ ^|
echo $$$$$$$$$$ $/ ^|_____/ ^|$
echo $$$$$$$$$ $$$$$$$$$$$$$
echo $$$$$$$$ $$$$$$$$$$$
pause >nul
color 07
exit /b







:: Expands the window
:: "Lines" is always 55 less than "columns"

:14
FOR /L %%A IN (81,1,160) DO (
set /a lines=%%A - 55
mode con cols=%%A lines=!lines!
ping localhost -n 1 >nul
)
pause
exit /b

















:: "(60,-1,0)" counts backwards

:C1
title Animation Box - 1 min
FOR /L %%A IN (60, -1,0) DO (
echo %%A
ping localhost -n 2 >nul
)
msg %username% One minute is over. 2>nul || pause >nul
exit /b






:: The "2009" written in zeros is shown longer than the others
:: --- Still no reasonable explanation for that

:C2
title Animation Box - 2009
echo __//////____///////____///////_____///////__
echo _////////__/////////__/////////___//_____//_
echo _//____//__//_____//__//_____//___//_____//_
echo ______//___//_____//__//_____//____////////_
echo _____//____//_____//__//_____//__________//_
echo ____//_____//_____//__//_____//__________//_
echo ___//______//_____//__//_____//___//_____//_
echo _////////__/////////__/////////___//_____//_
echo //////////__///////____///////_____///////__
ping localhost -n 2 >nul
cls
echo __000000____0000000____0000000_____0000000__
echo _00000000__000000000__000000000___00_____00_
echo _00____00__00_____00__00_____00___00_____00_
echo ______00___00_____00__00_____00____00000000_
echo _____00____00_____00__00_____00__________00_
echo ____00_____00_____00__00_____00__________00_
echo ___00______00_____00__00_____00___00_____00_
echo _00000000__000000000__000000000___00_____00_
echo 0000000000__0000000____0000000_____0000000__
ping localhost-n 2 >nul
cls
echo __888888____8888888____8888888_____8888888__
echo _88888888__888888888__888888888___88_____88_
echo _88____88__88_____88__88_____88___88_____88_
echo ______88___88_____88__88_____88____88888888_
echo _____88____88_____88__88_____88__________88_
echo ____88_____88_____88__88_____88__________88_
echo ___88______88_____88__88_____88___88_____88_
echo _88888888__888888888__888888888___88_____88_
echo 8888888888__8888888____8888888_____8888888__
ping localhost -n 2 >nul
cls
echo __@@@@@@____@@@@@@@____@@@@@@@_____@@@@@@@__
echo _@@@@@@@@__@@@@@@@@@__@@@@@@@@@___@@_____@@_
echo _@@____@@__@@_____@@__@@_____@@___@@_____@@_
echo ______@@___@@_____@@__@@_____@@____@@@@@@@@_
echo _____@@____@@_____@@__@@_____@@__________@@_
echo ____@@_____@@_____@@__@@_____@@__________@@_
echo ___@@______@@_____@@__@@_____@@___@@_____@@_
echo _@@@@@@@@__@@@@@@@@@__@@@@@@@@@___@@_____@@_
echo @@@@@@@@@@__@@@@@@@____@@@@@@@_____@@@@@@@__
ping localhost -n 2 >nul
exit /b






:: Background and font changing their colors

:C3
color 6a
ping localhost -n 1 >nul
color 8f
ping localhost -n 1 >nul
color 3e
ping localhost -n 1 >nul
color f9
ping localhost -n 1 >nul
color 01
ping localhost -n 1 >nul
color 09
ping localhost -n 1 >nul
color 67
ping localhost -n 1 >nul
color 43
ping localhost -n 1 >nul
color d4
ping localhost -n 1 >nul
color a7
ping localhost -n 1 >nul
color c1
ping localhost -n 1 >nul
color f0
ping localhost -n 1 >nul
color b0
ping localhost -n 1 >nul
color ab
ping localhost -n 1 >nul
color ce
ping localhost -n 1 >nul
color 9e
ping localhost -n 1 >nul
color a3
ping localhost -n 1 >nul
color 1e
ping localhost -n 1 >nul
color fd
ping localhost -n 1 >nul
color c7
ping localhost -n 1 >nul
color c4
ping localhost -n 1 >nul
color 91
ping localhost -n 1 >nul
color 61
ping localhost -n 1 >nul
color 6f
ping localhost -n 1 >nul
color 01
ping localhost -n 1 >nul
goto :C3







:: Using "telnet" to connect to a website that shows Star Wars 3 in batch

:C4
telnet towel.blinkenlights.nl
exit /b








:: Matrix animations from a random picture found in google
:: --- There are 7 animations, 4 have been finished, yet
:: --- The animations are from the Linux command prompt

:M1
title File System - File Manager
color 0a
mode con cols=110 lines=50
echo File Edit View Go Help
echo î î î î î
echo ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÉÍÍÍ»ÚÄÄÄÄ¿ÚÄÄÄÄÄÄÄ¿
echo ³ ÜÜÜ ³ ºÛÛ º³home³³Û shaun³
echo ³ [ ] shaun ³ ÈÍÍͼÀÄÄÄÄÙÀÄÄÄÄÄÄÄÙ
echo ³ ßßß ³
echo ³ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
echo ³ -^> ³ ³ ³
echo ³ Trash ³ ³ ³
echo ³ Ä ³ ³ ÛÛÜ ÛÛÜ ÛÛÜ ÛÛÜ ÛÛÜ ÛÛÜ ÛÛÜ ³
echo ³ ³ ³ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ³
echo ³ ÚÄÄÄÄÄ¿ ³ ³ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ³
echo ³ ³ ³ Desktop ³ ³ ÛÛß ÛÛß ÛÛß ÛÛß ÛÛß ÛÛß ÛÛß ³
echo ³ ÀÄÄÄÄÄÙ ³ ³ ³
echo ³ ³ ³ bin boot dev etc home lib lost+found ³
echo ³úúúÛÛÜúúúúúúúúúúúúúúúúúúúúúú³ ³ ³
echo ³úúúÛÛÛúúúúFileúsystemúúúúúúú³ ³ ³
echo ³úúúÛÛßúúúúúúúúúúúúúúúúúúúúúú³ ³ ÛÛÜ ÛÛÜ ÛÛÜ ÛÛÜ ÛÛÜ ÛÛÜ ÛÛÜ ³
echo ³ ³ ³ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ³
echo ³ ³ ³ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ³
echo ³ ³ ³ ÛÛß ÛÛß ÛÛß ÛÛß ÛÛß ÛÛß ÛÛß ³
echo ³ ³ ³ ³
echo ³ ³ ³ media mnt opt proc root sbin srv ³
echo ³ ³ ³ ³
echo ³ ³ ³ ³
echo ³ ³ ³ ÛÛÜ ÛÛÜ ÛÛÜ ÛÛÜ ³
echo ³ ³ ³ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ³
echo ³ ³ ³ ÛÛÛ ÛÛÛ ÛÛÛ ÛÛÛ ³
echo ³ ³ ³ ÛÛß ÛÛß ÛÛß ÛÛß ³
echo ³ ³ ³ ³
echo ³ ³ ³ sys tmp usr var ³
echo ³ ³ ³ ³
echo ³ ³ ³ ³
echo ³ ³ ³ ³
echo ³ ³ ³ ³
echo ³ ³ ³ ³
echo ³ ³ ³ ³
echo ³ ³ ³ ³
echo ³ ³ ³ ³
echo ³ ³ ³ ³
echo ³ ³ ³ ³
echo ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
pause >nul
color 07
exit /b







:M2
title Animation Box - Matrix part 2 - shaun@hacktop: cmatrix
color 0a
mode con cols=89 lines=33
echo e Y ^| - g ' ^| ? x 9 3 : $ S Q 7 / i
echo s I $ 3 ! o 2 } 7 L E 2 H I n 0 G ^( n ^^
echo Q : ; : 9 + { " 3 A R 8 + A > > y ] u j %%
echo + A ^) 7 B v M / \ " 6 / # Z 5 t j F # s 0
echo F ? _ { Z + N y K ^& C ? n l b Y l \ X T c Y ^|
echo B @ r I m [ E C ? I Q 5 , { h W p y 7 @ B . 6 c
echo Z _ e X 3 " V A V ` T h G r : s f 0 ` * , U
echo H Z I ^) x $ 5 1 q @ S = J R 9 B c ^& + r S
echo $ S # $ E d D ] Y \ h t 0 S " i y N Q ^| J
echo s P , C G h R = 7 W \ ^> M ^& 9 %% m x q ` b
echo ^> j s s Q ) _ e C : \ \ ! . b X ^< z - V w '
echo $ R U ! D b J t ^> P ^| ' ^^ ^> ^& P i K k f _ N 0
echo : Y 1 A # e ! ^( , / C 4 h , ? P P v n z ? 2 b 0
echo u q z $ v s p ; ; 2 w ' ] R \ 4 M o _ ? %% z H
echo r $ N # g S j K ; D z J C z 5 9 \ 4 A { c y * X p
echo _ S 0 k K = c B ^^ : J V P A { 2 ^( ' : I q R u 8
echo C . 2 j = X \ . l L Y f $ q 3 C = D t g D _ b /
echo { ^< %% 9 i - y a { F V u j X _ 3 v ^( 2 ^& 9 - \ 3
echo e 7 n v I " V F 5 Q ? B + k , 5 e 4 _
echo S : t ? D W 8 y D K ` @ U = @ 6 5 4 -
echo J ? t ' ) I ^^ n $ f * D c k r L Q J x e b
echo q ^^ u Q b 3 " 0 \ x 0 6 %% ` n [ c 8 - m
echo + $ i L ? L Y P q Z Z f i 8 b w W f c t q
echo @ Z L d q ` V a [ ; S c p 6 o X 1 4 F i
echo / 4 ^> : v ! q " P " d M c X 2 - ^> t 5 i R
echo : ? o 9 c B / ? * 0 ^^ e S 1 r O N ^( x ? * E
echo 8 D # ^| L q 8 V / i 9 a k { ^) n A y 8 o { `
echo 3 ? \ V t Y { ^< G ^& # } 5 c J e h p t Y = X $ \
echo N ; @ ] 2 e ^( u U + y 7 v S Z k S { p x C ^& ? T c 3
echo K 1 z ^& a F n 0 ' H m v F ; . b k b g o V ^|
echo " F ( d k { - I r # D T ( ; T N 3 { G Q * H
pause >nul
color 07
exit /b






:M3
title Animation Box - Matrix part 2 - shaun@hacktop: scrot -c -d 3
mode con cols=89 lines=33
color 0a
echo ÚÄ[shaun@hacktop][~]
echo ÀÄþ packer -Syu
echo Password:
echo :: Synchronizing package databases...
echo core is up to date
echo extra is up to date
echo community is up to date
echo :: Starting full system upgrade...
echo local database is up to date
echo :: Synchronizing aur database...
echo aur 6 6 [#############################] 100%%
echo :: Starting full aur upgrade...
echo local database is up to date
echo ÚÄ[shaun@hacktop][~]
echo ÀÄþ uptime
echo 03:16:23 up 5:10, 1 user, load average: 0.02, 0.08, 0.08
echo ÚÄ[shaun@hacktop][~]
echo ÀÄþ acpi
echo Battery 0: Full, 100%%
echo ÚÄ[shaun@hacktop][~]
echo ÀÄþ uname -a
echo Linux hacktop 2.6.32-ARCH #1 SMP REEMPT Tue Feb 9 14:46:08 UTC 2010 i686 Intel(R) Pentium(R) M processor 1.73GHz Genuine Intel GNU /Linux
echo ÚÄ[shaun@hacktop][~]
echo ÀÄþ scrot -c -d 3
echo Taking shot in 3.. 2.. 1.. Û
pause >nul
color 07
exit /b








:M4
title Animation Box - Matrix part 2 - shaun@hacktop: ~
mode con cols=89 lines=33
color 0a
echo ÚÄ[shaun@hacktop][~]
echo ÀÄþ archey
echo.
echo +
echo # OS: Arch Linux i686
echo ### Hostname: hacktop
echo ##### Kernel: 2.6.32-ARCH
echo ####### Uptime: 5:10
echo ;#######; Window Manager: wmii
echo ######### Desktop Environment: None found
echo ########### Packaged: 364
echo ############# RAM: 274 MB / 2017 MB
echo ############### CPU: Intel(R) Pentium(R) M Processor 1,73 GHz
echo ####### ####### Shell: Zsh
echo .######; ;######. Root FS: 1.9G / 70G (ext3)
echo .#######; ;#######.
echo #########. .#########
echo ######' '######
echo ;#### ####;
echo ##' '##
echo #' '#
echo.
echo ÚÄ[shaun@hacktop][~]
echo ÀÄþ []
pause >nul
color 07
exit /b

















:: Reset variables from all animations to prevent missexecution
:: "exit /b" quits the last used CALL-command

:ResetVariables
set choice=
set Color=
set Counter=0
set Height=
set Length=
set Line=
FOR /L %%A IN (1,1,25) DO set Line%%A=
set Schalter=2
set Weight=
exit /b
author

Thoughts?

author

my computer won't understand it

author
lalarcon1 (author)2015-07-11

This is not advanced, this is basic!

check this:

@setlocal enableextensions enabledelayedexpansion

@echo off

color 17

title Movement 2 ~ Grid

cls

goto data

:data

set lespa=

set rispa=

set space=5

set err=0

set right=10

set left=10

:hud

cls

echo Move your character (X) with the WASD keys. Press R to reset

echo #######################

if %space% equ 0 if %err% neq 1 (

echo #%lespa%X%rispa%#

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # # )

if %space% equ 1 if %err% neq 1 (

echo # #

echo #%lespa%X%rispa%#

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # # )

if %space% equ 2 if %err% neq 1 (

echo # #

echo # #

echo #%lespa%X%rispa%#

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # # )

if %space% equ 3 if %err% neq 1 (

echo # #

echo # #

echo # #

echo #%lespa%X%rispa%#

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # # )

if %space% equ 4 if %err% neq 1 (

echo # #

echo # #

echo # #

echo # #

echo #%lespa%X%rispa%#

echo # #

echo # #

echo # #

echo # #

echo # #

echo # # )

if %space% equ 5 if %err% neq 1 (

echo # #

echo # #

echo # #

echo # #

echo # #

echo #%lespa%X%rispa%#

echo # #

echo # #

echo # #

echo # #

echo # # )

if %space% equ 6 if %err% neq 1 (

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo #%lespa%X%rispa%#

echo # #

echo # #

echo # #

echo # # )

if %space% equ 7 if %err% neq 1 (

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo #%lespa%X%rispa%#

echo # #

echo # #

echo # # )

if %space% equ 8 if %err% neq 1 (

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo #%lespa%X%rispa%#

echo # #

echo # # )

if %space% equ 9 if %err% neq 1 (

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo #%lespa%X%rispa%#

echo # # )

if %space% equ 10 if %err% neq 1 (

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo # #

echo #%lespa%X%rispa%# )

echo #######################

echo.

echo.

choice /c wasdr /n

if %errorlevel% equ 1 goto w

if %errorlevel% equ 2 goto a

if %errorlevel% equ 3 goto s

if %errorlevel% equ 4 goto d

if %errorlevel% equ 5 goto data

:w

set /a space=%space%-1

if %space% lss 0 set space=0

goto hud

:a

set lespa=!lespa:~0,-1!

set /a left=%left%-1

if %left% lss 1 set left=1 && set lespa=%lespa%

set rispa=%rispa%

set /a right=%right%+1

if %right% gtr 19 set right=19 && set rispa=!rispa:~0,-1!

goto hud

:s

set /a space=%space%+1

if %space% gtr 10 set space=10

goto hud

:d

set rispa=!rispa:~0,-1!

set /a right=%right%-1

if %right% lss 1 set right=1 && set rispa=%rispa%

set lespa=%lespa%

set /a left=%left%+1

if %left% gtr 19 set left=19 && set lespa=!lespa:~0,-1!

goto hud

author
graboy (author)2010-02-09

^^ I think I'm the only person who got the IF's AND's or NOT's thing. "NOR" does anyone other than us know what were talking about.

author
BrianW16 (author)graboy2015-06-17

IF, AND, NOT is used pretty much same way as in standard english

author
Files (author)graboy2010-08-17

:o I think I got it too. "IF" "AND" "NOT"

author
will421 (author)Files2011-02-10

I GOT IT TOO!
IF you thought they were batch commands AND NOT just in regular old all caps, you got it!

author
BrianW16 (author)2015-06-17

even easier:

@echo off

@title rainbows!

:1

color

color 01

color 10

color 12

color 21

color 23

color 32

color 34

color 43

color 45

color 54

color 56

color 65

color 67

color 76

color 78

color 87

color 89

color 98

color 9a

color a9

color ab

color ba

color bc

color cb

color de

color ed

color ef

color fe

goto 1

author
BrianW16 (author)2015-06-17

faster, easier:

@echo off

:1

title rainbows!

color 01

title rainbows!

color 10

title rainbows!

color 12

title rainbows!

color 21

title rainbows!

color 23

title rainbows!

color 32

title rainbows!

color 34

title rainbows!

color 43

title rainbows!

color 45

title rainbows!

color 54

title rainbows!

color 56

title rainbows!

color 65

title rainbows!

color 67

title rainbows!

color 76

title rainbows!

color 78

title rainbows!

color 87

title rainbows!

color 89

title rainbows!

color 98

title rainbows!

color 9a

title rainbows!

color a9

title rainbows!

color ab

title rainbows!

color ba

title rainbows!

color bc

title rainbows!

color cb

title rainbows!

color de

title rainbows!

color ed

title rainbows!

color ef

title rainbows!

color fe

goto 1

author
AdamC8 (author)2014-12-30

here is a super-fast rainbow code i made:

@echo off

:1

title rainbows!

color 01

goto 2

:2

title rainbows!

color 10

goto 3

:3

title rainbows!

color 12

goto 4

:4

title rainbows!

color 21

goto 5

:5

title rainbows!

color 23

goto 6

:6

title rainbows!

color 32

goto 7

:7

title rainbows!

color 34

goto 8

:8

title rainbows!

color 43

goto 9

:9

title rainbows!

color 45

goto 10

:10

title rainbows!

color 54

goto 11

:11

title rainbows!

color 56

goto 12

:12

title rainbows!

color 65

goto 13

:13

title rainbows!

color 67

goto 14

:14

title rainbows!

color 76

goto 15

:15

title rainbows!

color 78

goto 16

:16

title rainbows!

color 87

goto 17

:17

title rainbows!

color 89

goto 18

:18

title rainbows!

color 98

goto 19

:19

title rainbows!

color 9a

goto 20

:20

title rainbows!

color a9

goto 21

:21

title rainbows!

color ab

goto 22

:22

title rainbows!

color ba

goto 23

:23

title rainbows!

color bc

goto 24

:24

title rainbows!

color cb

goto 25

:25

title rainbows!

color de

goto 26

:26

title rainbows!

color ed

goto 27

:27

title rainbows!

color ef

goto 28

:28

title rainbows!

color fe

goto 1

author
el-xavi26 (author)2012-09-08

How do i make a line so then somebody could write on batch please answer

author
spenaq1 (author)el-xavi262013-09-07

You make it so the person using your program can write by doing this command
set/p input=Enter:
That will make it so they can enter their own words.

author
Regulators (author)spenaq12014-04-21

yes, you can just write this command into notepad

set /p "input=what do you want to type? "

pause>nul

that's a simple code for allowing user to type something in batch file

author
Prof. Pickle (author)el-xavi262012-12-19

ATTRIB +R Script.bat

The above should work, but it's not hole proof and any slightly technically savvy person can undo it.

author
Regulators (author)2014-04-21

this batch is very cool, but i made my own batch file to download some files from internet, its like download manager but in batch

please visit this instructables https://www.instructables.com/id/How-To-download-Fi...

thank you!

author
nasir geelani (author)2013-03-26

thanx pro neodudeman and all programmers thanx for all these instructibles

author
Gonads (author)2010-02-12

 hey for the %random% you can change the range.. try this:

set /a random=%random%/327.67

now range is between 1 - 100

author
Prof. Pickle (author)Gonads2012-12-13

Well, actually, there is a much easier way to do that.

In the Command Prompt: set /a number=%random% % max + min
Example:set /a dice=%random% % 6 + 1

In a batch script: set /a number=%random% %% max + min
Example: set /a dice=%random% %% 6 + 1

Oh, and setting the variable named "random" as %random% is not wise, as it will stop you using "%random%" again, as it would just be calling the pre-set variable. 

author
Broom (author)2012-06-04

This could have been a really great tutorial, but unfortunately all your code has been catenated onto single lines.

Try editing it, and separating each code line with a blank line.

author
Bladesofvengence (author)2012-04-26

I made a Number guessing game batch but i cant get it to work.
@ECHO OFF
title Guess what number i am thinking of!
color D0
if exist SAVEGAME.bat goto top
SET /a score1=10
SET /a score2=10
SET /a score3=10
SET /a score4=10
SET /a score5=10
SET name1=aaa
SET name2=bbb
SET name3=ccc
SET name4=ddd
SET name5=eee
Goto mum
:top
call SAVEGAME.bat
:mum
SET /a GuessLimit=100
:start
SET tries=11
cls
ECHO Guess what Number I'm thinking of. (0-100)
ECHO Be careful, you only have limited tries!
ECHO Press any key to continue.
pause>nul
SET /a GuessNum=0
:begin
SET /a Answer=%RANDOM%
if %Answer% gtr 100 goto begin
:Retry
cls
SET /a tries=%tries%-1
SET /a Left=11-%tries%
if %tries% equ 0 (goto penalty)
ECHO You have %tries% attempts left.
ECHO Please type your guess number then press enter.
SET /p Guess=
SET /a GuessNum=%GuessNum%+1
IF %Guess%==overlord goto END2
IF %Guess% LSS %Answer% ECHO My Number is Higher.
IF %Guess% GTR %Answer% ECHO My Number is Lower.
IF %Guess%==%Answer% GOTO END
ECHO Press any key to continue.
pause>nul
ECHO.
GOTO Retry
:penalty
ECHO Sorry, you have run out of tries.
ECHO Better luck next time!
ECHO The Answer was %Answer%
ECHO Do you want to play again? Yes/No
SET /p Answer=
IF %Answer%==yes GOTO start
IF %Answer%==Yes GOTO start
IF %Answer%==no GOTO Exit
IF %Answer%==No GOTO Exit
:END
cls
ECHO You are Correct!
ECHO The Answer was %Answer%
ECHO It took %GuessNum% Guesses.
ECHO Please write your name.
SET /p name=
IF %Left% LSS %score1% GOTO sub1
IF %Left% LSS %score2% GOTO Sub2
IF %Left% LSS %score3% GOTO Sub3
IF %Left% LSS %score4% GOTO Sub4
IF %Left% LSS %score5% GOTO Sub5
:overlord
ECHO Do you want to play again? Yes/No
SET /p Answer=
IF %Answer%==yes GOTO start
IF %Answer%==Yes GOTO start
IF %Answer%==no GOTO Exit
IF %Answer%==No GOTO Exit
:END2
cls
ECHO You are Correct!
ECHO The Answer was %Answer%
ECHO It took %GuessNum% Guesses.
ECHO Do you want to play again? Yes/No
SET /p Answer=
IF %Answer%==yes GOTO start
IF %Answer%==Yes GOTO start
IF %Answer%==no GOTO Exit
IF %Answer%==No GOTO Exit
:Exit
exit
:sub1
SET /a score5=%score4%
SET /a score4=%score3%
SET /a score3=%score2%
SET /a score2=%score1%
SET /a score1=%Left%
SET name5=%name4%
SET name4=%name3%
SET name3=%name2%
SET name2=%name1%
SET name1=%name%
GOTO HiscoreList
:Sub2
SET /a score5=%score4%
SET /a score4=%score3%
SET /a score3=%score2%
SET /a score2=%Left%
SET name5=%name4%
SET name4=%name3%
SET name3=%name2%
SET name2=%name%
GOTO HiscoreList
:Sub3
SET /a score5=%score4%
SET /a score4=%score3%
SET /a score3=%Left%
SET name5=%name4%
SET name4=%name3%
SET name3=%name%
GOTO HiscoreList
:Sub4
SET /a score5=%score4%
SET /a score4=%Left%
SET name5=%name4%
SET name4=%name%
GOTO HiscoreList
:Sub5
SET /a score5=%Left%
SET name5=%name%
:HiscoreList
ECHO.
ECHO HISCORES
ECHO 1. %name1% %score1%
ECHO 2. %name2% %score2%
ECHO 3. %name3% %score3%
ECHO 4. %name4% %score4%
ECHO 5. %name5% %score5%
if exist SAVEGAME.bat del SAVEGAME.bat
ECHO @echo off>SAVEGAME.bat
ECHO set name1=%name1%>>SAVEGAME.bat
ECHO set name2=%name2%>>SAVEGAME.bat
ECHO set name3=%name3%>>SAVEGAME.bat
ECHO set name4=%name4%>>SAVEGAME.bat
ECHO set name5=%name5%>>SAVEGAME.bat
ECHO set score1=%score1%>>SAVEGAME.bat
ECHO set score2=%score2%>>SAVEGAME.bat
ECHO set score3=%score3%>>SAVEGAME.bat
ECHO set score4=%score4%>>SAVEGAME.bat
ECHO set score5=%score5%>>SAVEGAME.bat
pause>nul
GOTO overlord

author
fhkoekje (author)2010-05-18

i changed your code for the number guessing game
i added a simple cheat and made the game a little easier:
the number doesn't go higher than 100

@ECHO OFF
:start
cls
SET /a GuessNum=0
:begin
SET /a Answer=%RANDOM%
if %Answer% gtr 100 goto begin
:Retry
ECHO Guess what Number I'm thinking of.
SET /p Guess=
SET /a GuessNum=%GuessNum%+1
IF %Guess%==cheat goto END
IF %Guess% LSS %Answer% ECHO My Number is Higher.
IF %Guess% GTR %Answer% ECHO My Number is Lower.
IF %Guess%==%Answer% GOTO END
ECHO.
pause>nul
cls
GOTO Retry
:END
cls
ECHO You are Correct!
echo The Answer was %Answer%
ECHO It took %GuessNum% Guesses.
ECHO.
pause
goto start

author
silvan9145jr (author)fhkoekje2011-08-18

I added on to yours.

@ECHO OFF
title Guess the Number!
color 0b
SET /a GuessLimit=15
:start
cls
ECHO Guess what Number I'm thinking of. (0-100)
SET /a GuessNum=0
:begin
SET /a Answer=%RANDOM%
if %Answer% gtr 100 goto begin
:Retry
SET /p Guess=
SET /a GuessNum=%GuessNum%+1
IF %Guess%==cheat goto END
IF %Guess% LSS %Answer% ECHO My Number is Higher.
IF %Guess% GTR %Answer% ECHO My Number is Lower.
IF %Guess%==%Answer% GOTO END
IF %GuessNum% GTR %GuessLimit% (
start http://www.google.com/
)
ECHO.
GOTO Retry
:END
cls
ECHO You are Correct!
echo The Answer was %Answer%
ECHO It took %GuessNum% Guesses.
ECHO.
echo Press any key to play again. :)
pause>nul
goto start

You can change the google.com to whatever you want so that if they dont guess in 15 tries they go to the designated website >:D

author
teh_pwnage (author)fhkoekje2010-07-16

@ECHO OFF color 29 :hmm? Echo Chose the right number or get PWNED! echo. echo. set /p lol=Choose or ELSE!!!))) if %lol%== 8 good... if not %lol%== 8 goto pwn :pwn start http://www.youtube.com/watch?v=oHg5SJYRHA0&feature=related/ exit :good... echo You got lucky... pause >nul

author
crazyman135790 (author)2011-04-21

cd..
cd..
cd..
cd..
cd..
dir /s

author
Files (author)2010-08-17

I mine as well should add my variation.I got ideas from various people, but I mainly just edited and added in some new echo's and added some extra info.



@ECHO OFF
title Command Prompt - Made by NetworkNinja Editted by Mikeyy
color 20
echo Calculator V1.3
echo Made by NetworkNinja echo Editted by Mikeyy
echo ---------------------
echo LEARN:
echo * = Multiply
echo / = Divide
echo + = Addition
echo - = Subtracting
echo ---------------------
:blah
ECHO.
SET /p UDefine=
SET /a UDefine=
%UDefine%
ECHO =
ECHO
%UDefine%
ECHO.
PAUSE
ECHO.
echo THANK YOU FOR USING OUR CALCULATOR!
ECHO -------------------------------------------------------------------------------- ECHO.
goto blah

author
teh_pwnage (author)2010-07-16

You could do this: @echo off color 0a :lol echo %random%%random%%random%%random%%random%%random%%random%%random%%random% goto lol

author
teh_pwnage (author)2010-07-16

@ECHO OFF color 29 :hmm? Echo Chose the right number or get PWNED! echo. echo. set /p lol=Choose or ELSE!!!))) if %lol%== 8 good... if not %lol%== 8 goto pwn :pwn start http://www.youtube.com/watch?v=oHg5SJYRHA0&feature=related/ exit :good... echo You got lucky... pause >nul

author
Shagglepuff (author)2008-07-10

@echo off
color 29
Echo Chose the right number or get PWNED!
SET /p doom1=
SET boom2=8
IF %doom1%NEQ%boom2% (
start http:/www.epicwinrar.com/
)
I tried this batch out but it didn't work. What did I do wrong?

author
Neodudeman (author)Shagglepuff2008-07-11

@ECHO OFF
color 29
Echo Chose the right number or get PWNED!
SET /p doom1=
SET boom2=8
IF %doom1% NEQ %boom2% (
start http:/www.wikipedia.org/
)

You didn't put spaces between %doom1%NEQ%boom2%

It should be %doom1% (SPACE) NEQ (SPACE) %boom2%

author
teh_pwnage (author)Neodudeman2010-07-16

@ECHO OFF color 29 :hmm? Echo Chose the right number or get PWNED! echo. echo. set /p lol=Choose or ELSE!!!))) if %lol%== 8 good... if not %lol%== 8 goto pwn :pwn start http://www.youtube.com/watch?v=oHg5SJYRHA0&feature=related/ exit :good... echo You got lucky... pause >nul

author
Shagglepuff (author)Neodudeman2008-07-11

Thanks. Time to own my parents...

author
teh_pwnage (author)Shagglepuff2010-07-16

@ECHO OFF color 29 :hmm? Echo Chose the right number or get PWNED! echo. echo. set /p lol=Choose or ELSE!!!))) if %lol%== 8 good... if not %lol%== 8 goto pwn :pwn start http://www.youtube.com/watch?v=oHg5SJYRHA0&feature=related/ exit :good... echo You got lucky... pause >nul

author
will421 (author)Shagglepuff2009-06-25

EKKKK!!! Rick roll!

author
tinkerC (author)2009-07-12

How do you read a file using Batch?

author
Guard13007 (author)tinkerC2010-04-10

 It's really complex and long, don't bother unless you really need to.

Unless you're just trying to read one line, in which case:

set var=<"file"
echo %var%

But that only works in XP...

author
tinkerC (author)Guard130072010-04-11

 No, I mean, read a file as in a configuration file.

author
MacDynamo (author)tinkerC2010-06-26

::type Configure.Extension | find /i "Variable" > OutputFile.Extension ::set /p SetupVariable= < OutputFile.Extension ::set ProgramVariable=%SetupVariable:~X,Y% ::X and Y being the first and last character number eg. Variable=10 is x=10, y=11 ::PM me if you still need help (had to make this brief for some reason)

author
HJP (author)2007-07-06

Just a question but do you know how the %random% variable works? I would think it'd be a script that is on your computer and if so then you could possibly create another script with your own range. Just posting this. This is really cool though.

author
Neodudeman (author)HJP2007-07-06
I'm honestly not sure how the %random% works. Here's a little code that will specify the range for you:
@ECHO OFFSet /a num=%random%ECHO Input MaximumSet /p high=ECHO Input MinimumSet /p low=ECHO.ECHO The Number Is::RetryIf %num% LEQ %high% (If %num% GEQ %low% ECHO %num%) ELSE (Set /a num=%random%GOTO Retry)Pause
What it does is it keeps randomizing a variable until it fits the parameters you set.
author
HJP (author)Neodudeman2007-07-08

Hey how can I implement this code into the guessing game. I'm trying to fiqure it out. ...maybe if instead showing the number I can have it run from the :Retry label...

author
HJP (author)HJP2007-07-08

Nevermind I figured it out.
_
@ECHO OFF
Cls
Set /a Answer=%random%
ECHO Input Maximum
Set /p high=
ECHO Input Minimum
Set /p low=
ECHO.
ECHO.
:Retry
If %Answer% LEQ %high% (
If %Answer% GEQ %low% ECHO Now guess what Number I'm thinking of
) ELSE (
Set /a Answer=%random%
GOTO Retry
)
Pause

:Reset
SET /p Guess=
IF %Guess% LSS %Answer% ECHO My Number is Higher.
IF %Guess% GTR %Answer% ECHO My Number is Lower.
IF %Guess%==%Answer% GOTO END
ECHO.
SET /a GuessNum=%GuessNum%+1
GOTO Reset
:END
ECHO You are Correct! The Answer was %Answer%
ECHO It took %GuessNum% Guesses.
ECHO.
PAUSE

ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
SET Yes=1
SET No=2
Echo.Play Again? 1 for Yes or 2 for No
Set /p ANS=
If %ANS% EQU %Yes% (CALL GUESSGAME.BAT
) ELSE (
Echo.Ok just go pass the Pause.
)
Pause
_

Just make sure that on the Call command (5 up from the bottom) that it calls the name of your game.

Oh, another question if you make the game into an .exe application or even .com how do you recall the game if you want to play again?

author
Neodudeman (author)HJP2007-07-23
I don't understand what you mean by recall.

You mean like, save game?

I'm not sure, and I can't test now, but maybe if you did something like save your variables into a .bat, and then use the CALL command to recall those variables.

I.E.
ECHO SET /a Guessnum=%Guessnum>SaveGame.batECHO SET /a Answer=%Answer%>>SaveGame.bat
Then, you use:
CALL SaveGame.bat
and it should give you those numbers back.
author
HJP (author)Neodudeman2007-07-23

I wasn't thinking of that. That's a good idea though. and it might work though you would have to give them diff variable names in there or they would over write the default so you would have a higher number. But what I meant was restarting the same program with out closing out and then starting it again. Like if you could get the program to ask if you wanted to play again. I did it using the batch file but i'm not sure if it would work with an exe file.

author
Neodudeman (author)HJP2007-07-23

Ohhhh. I think I see. I think that the .exe file would work just like the .bat file. Just so long as you're compiling it with the bat2exe program that I supplied in Slightly More Advanced Basic Batch

(I just realized how long that name is. lol.)

About This Instructable

104,636views

49favorites

License:

More by Neodudeman:NES Controller CellphoneAdvanced BatchBasics of Batch Files
Add instructable to: