Introduction: War Based Game in Batch File

This is a batch file that I have made fairly recently that is a cold war simulation. It took two days to complete for me because half of the script is based on the other half. Please tell me if there are any errors in the script and I will fix them. Thanks. Enjoy!

@echo off
color 0c
title TOTAL WAR!!!
echo.
echo Welcome to Total War, created by Vincent Allain.
echo.
pause
:players
cls
set player=
set replay=
echo.
set /p player=Select 1 or 2 player mode:
if '%player%'=='1' goto name
if '%player%'=='2' goto p1name
goto players
:name
cls
set name=
echo.
set /p name=Please type in your name (One word):
if '%name%'=='' goto name
rem Easter Egg:
if '%name%'=='Vincent' goto win
:country
cls
set country=
set enemy=
echo.
echo Welcome %name%!
echo.
set /p country=Choose your country; USA, Russia, or Canada:
if '%country%'=='usa' goto enemy1
if '%country%'=='USA' goto enemy1
if '%country%'=='Usa' goto enemy1
if '%country%'=='Russia' goto enemy2
if '%country%'=='russia' goto enemy2
if '%country%'=='canada' goto enemy3
if '%country%'=='Canada' goto enemy3
goto country
:enemy1
set country=USA
goto enemy
:enemy2
set country=Russia
goto enemy
:enemy3
set country=Canada
:enemy
set /a cpucountryrand=%random% %%5 +1
if '%cpucountryrand%'=='0' goto enemy
if '%cpucountryrand%'=='1' set enemy=Russia
if '%cpucountryrand%'=='2' set enemy=USA
if '%cpucountryrand%'=='3' set enemy=Canada
if '%cpucountryrand%'=='4' goto enemy
if '%cpucountryrand%'=='5' goto enemy
if '%enemy%'=='%country%' goto enemy
:begin
set user=1000
set cpu=1000
set nuke=1
set airstrike=2
set missiles=3
set cpunuke=1
set cpuairstrike=2
set cpumissiles=3
:gameplay
cls
set move=
set choice=
set cpucount=0
echo.
echo %name%, your turn.
echo                                                               %country%: %user% DEF
echo Options:
echo                                                               %enemy%: %cpu% DEF
echo 1. Fire NUKE x %nuke%
echo.
echo 2. Fire Airstrike x %airstrike%
echo.
echo 3. Fire Missiles x %missiles%
echo.
echo 4. Surrender
echo.
echo 5. Do nothing
echo.
set /p move=Select your option:
if '%move%'=='1' goto nuke
if '%move%'=='2' goto airstrike
if '%move%'=='3' goto missiles
if '%move%'=='4' goto surrender
if '%move%'=='5' goto cpu1
goto gameplay
:nuke
cls
if '%nuke%'=='0' goto nonuke
echo.
echo %name% has fired a NUKE headed towards the %enemy%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %enemy% has lost 400 DEF!
echo.
pause
set /a cpu=%cpu% - 400
set nuke=0
if '%cpu%'=='0' goto win
if '%cpu%'=='-100' goto win
if '%cpu%'=='-200' goto win
if '%cpu%'=='-300' goto win
goto cpu1
:nonuke
echo.
echo You can't use a nuke since you don't have any more left!
echo.
pause
goto gameplay
:airstrike
cls
if '%airstrike%'=='0' goto noairstrike
echo.
echo %name% has fired an airstrike on the %enemy%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %enemy% has lost 300 DEF!
echo.
pause
set /a cpu=%cpu% - 300
set /a airstrike=%airstrike% - 1
if '%cpu%'=='0' goto win
if '%cpu%'=='-100' goto win
if '%cpu%'=='-200' goto win
if '%cpu%'=='-300' goto win
goto cpu1
:noairstrike
echo.
echo You can't use an airstrike since you don't have any more left!
echo.
pause
goto gameplay
:missiles
cls
if '%missiles%'=='0' goto nomissiles
echo.
echo %name% has fired multiple missiles headed towards the %enemy%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %enemy% has lost 200 DEF!
echo.
pause
set /a cpu=%cpu% - 200
set /a missiles=%missiles% - 1
if '%cpu%'=='0' goto win
if '%cpu%'=='-100' goto win
if '%cpu%'=='-200' goto win
if '%cpu%'=='-300' goto win
goto cpu1
:nomissiles
echo.
echo You can't use missiles since you don't have any more left!
echo.
pause
goto gameplay
:surrender
cls
echo.
echo "We may have lost the war, but we still have our dignity..."
echo.
pause
:end
cls
echo.
echo "We may have lost the war, but we still have our dignity..."
echo.
set /p replay=Type anything to replay the game. Type 'x' to exit:
if '%replay%'=='x' goto suggest
if '%replay%'=='' goto end
goto players
:win
cls
echo.
echo You have won Total War!!!
echo.
pause
:win2
cls
echo.
echo You have won Total War!!!
echo.
set /p replay=Type anything to replay the game. Type 'x' to exit:
if '%replay%'=='x' goto suggest
if '%replay%'=='' goto win2
goto players
:cpu1
cls
set /a cpucount=%cpucount% + 1
if '%cpucount%'=='10' goto cpu2
echo.
echo My turn.
echo                                                               %country%: %user% DEF
echo Options:
echo                                                               %enemy%: %cpu% DEF
echo 1. Fire NUKE x %cpunuke%
echo.
echo 2. Fire Airstrike x %cpuairstrike%
echo.
echo 3. Fire Missiles x %cpumissiles%
echo.
echo 4. Surrender
echo.
echo 5. Do nothing
echo.
echo Select your option:/
ping localhost -n 1 >nul
ping localhost -n 1 >nul
ping localhost -n 1 >nul
ping localhost -n 1 >nul
cls
echo.
echo My turn.
echo                                                               %country%: %user% DEF
echo Options:
echo                                                               %enemy%: %cpu% DEF
echo 1. Fire NUKE x %cpunuke%
echo.
echo 2. Fire Airstrike x %cpuairstrike%
echo.
echo 3. Fire Missiles x %cpumissiles%
echo.
echo 4. Surrender
echo.
echo 5. Do nothing
echo.
echo Select your option:-
ping localhost -n 1 >nul
ping localhost -n 1 >nul
ping localhost -n 1 >nul
ping localhost -n 1 >nul
cls
echo.
echo My turn.
echo                                                               %country%: %user% DEF
echo Options:
echo                                                               %enemy%: %cpu% DEF
echo 1. Fire NUKE x %cpunuke%
echo.
echo 2. Fire Airstrike x %cpuairstrike%
echo.
echo 3. Fire Missiles x %cpumissiles%
echo.
echo 4. Surrender
echo.
echo 5. Do nothing
echo.
echo Select your option:\
ping localhost -n 1 >nul
ping localhost -n 1 >nul
ping localhost -n 1 >nul
ping localhost -n 1 >nul
goto cpu1
:cpu2
cls
set /a choice=%random% %%6
if '%choice%'=='0' goto cpu2
if '%choice%'=='4' goto cpu2
if '%choice%'=='6' goto cpu2
echo.
echo My turn.
echo                                                               %country%: %user% DEF
echo Options:
echo                                                               %enemy%: %cpu% DEF
echo 1. Fire NUKE x %cpunuke%
echo.
echo 2. Fire Airstrike x %cpuairstrike%
echo.
echo 3. Fire Missiles x %cpumissiles%
echo.
echo 4. Surrender
echo.
echo 5. Do nothing
echo.
echo Select your option:%choice%
ping localhost -n 4 >nul
if '%choice%'=='1' goto cpunuke
if '%choice%'=='2' goto cpuairstrike
if '%choice%'=='3' goto cpumissiles
if '%choice%'=='5' goto gameplay
:cpunuke
cls
if '%cpunuke%'=='0' goto nocpunuke
echo.
echo I have fired a NUKE headed towards the %country%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %country% has lost 400 DEF!
echo.
ping localhost -n 4 >nul
set /a user=%user% - 400
set cpunuke=0
if '%user%'=='0' goto cpuwin
if '%user%'=='-100' goto cpuwin
if '%user%'=='-200' goto cpuwin
if '%user%'=='-300' goto cpuwin
goto gameplay
:nocpunuke
echo.
echo I can't use a nuke since I don't have any more left!
echo.
ping localhost -n 4 >nul
set cpucount=0
goto cpu1
:cpuairstrike
cls
if '%cpuairstrike%'=='0' goto nocpuairstrike
echo.
echo I have fired an airstrike on the %country%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %country% has lost 300 DEF!
echo.
ping localhost -n 4 >nul
set /a user=%user% - 300
set /a cpuairstrike=%cpuairstrike% - 1
if '%user%'=='0' goto cpuwin
if '%user%'=='-100' goto cpuwin
if '%user%'=='-200' goto cpuwin
if '%user%'=='-300' goto cpuwin
goto gameplay
:nocpuairstrike
echo.
echo I can't use an airstrike since I don't have any more left!
echo.
ping localhost -n 4 >nul
set cpucount=0
goto cpu1
:cpumissiles
cls
if '%cpumissiles%'=='0' goto nocpumissiles
echo.
echo I have fired multiple missiles headed towards the %country%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %country% has lost 200 DEF!
echo.
ping localhost -n 4 >nul
set /a user=%user% - 200
set /a cpumissiles=%cpumissiles% - 1
if '%user%'=='0' goto cpuwin
if '%user%'=='-100' goto cpuwin
if '%user%'=='-200' goto cpuwin
if '%user%'=='-300' goto cpuwin
goto gameplay
:nocpumissiles
echo.
echo I can't use missiles since I don't have any more left!
echo.
ping localhost -n 4 >nul
set cpucount=0
goto cpu1
:cpuwin
cls
echo.
echo It was a long battle today. I have emerged victorious, even though you tried
echo very well.
echo.
pause
:cpuwin2
cls
echo.
echo It was a long battle today. I have emerged victorious, even though you tried
echo very well.
echo.
set /p replay=Type anything to replay the game. Type 'x' to exit:
if '%replay%'=='x' goto suggest
if '%replay%'=='' goto cpuwin2
goto players
:p1name
cls
set p1name=
echo.
set /p p1name=Player 1, please type in your name (One word):
if '%p1name%'=='' goto p1name
:p2name
cls
set p2name=
echo.
set /p p2name=Player 2, please type in your name (One word):
if '%p2name%'=='%p1name%' goto p2name
if '%p2name%'=='' goto p2name
rem Easter Egg:
if '%p1name%'=='Vincent' goto p1win
if '%p2name%'=='Vincent' goto p2win
:p1country
cls
set p1country=
echo.
echo Welcome %p1name%!
echo.
set /p p1country=Choose your country; USA, Russia, or Canada:
if '%p1country%'=='usa' goto p1country1
if '%p1country%'=='USA' goto p1country1
if '%p1country%'=='Usa' goto p1country1
if '%p1country%'=='Russia' goto p1country2
if '%p1country%'=='russia' goto p1country2
if '%p1country%'=='canada' goto p1country3
if '%p1country%'=='Canada' goto p1country3
goto p1country
:p1country1
set p1country=USA
goto p2country
:p1country2
set p1country=Russia
goto p2country
:p1country3
set p1country=Canada
:p2country
cls
set p2country=
echo.
echo Welcome %p2name%!
echo.
set /p p2country=Choose your country; USA, Russia, or Canada:
if '%p2country%'=='%p1country%' goto na
if '%p2country%'=='usa' goto p2country1
if '%p2country%'=='USA' goto p2country1
if '%p2country%'=='Usa' goto p2country1
if '%p2country%'=='Russia' goto p2country2
if '%p2country%'=='russia' goto p2country2
if '%p2country%'=='canada' goto p2country3
if '%p2country%'=='Canada' goto p2country3
goto p2country
:na
cls
echo.
echo You can't choose %p1country% because %p1name% has already chosen it.
pause >nul
goto p2country
:p2country1
set p2country=USA
goto begin2
:p2country2
set p2country=Russia
goto begin2
:p2country3
set p2country=Canada
:begin2
set p1health=1000
set p2health=1000
set p1nuke=1
set p1airstrike=2
set p1missiles=3
set p2nuke=1
set p2airstrike=2
set p2missiles=3
:p1gameplay
cls
set move=
set choice=
echo.
echo %p1name%, your turn.
echo                                                               %p1country%: %p1health% DEF
echo Options:
echo                                                               %p2country%: %p2health% DEF
echo 1. Fire NUKE x %p1nuke%
echo.
echo 2. Fire Airstrike x %p1airstrike%
echo.
echo 3. Fire Missiles x %p1missiles%
echo.
echo 4. Surrender
echo.
echo 5. Do nothing
echo.
set /p move=Select your option:
if '%move%'=='1' goto p1nuke
if '%move%'=='2' goto p1airstrike
if '%move%'=='3' goto p1missiles
if '%move%'=='4' goto p1surrender
if '%move%'=='5' goto p2gameplay
goto p1gameplay
:p1nuke
cls
if '%p1nuke%'=='0' goto nop1nuke
echo.
echo %p1name% has fired a NUKE headed towards %p2country%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %p2country% has lost 400 DEF!
echo.
pause
set /a p2health=%p2health% - 400
set p1nuke=0
if '%p2health%'=='0' goto p1win
if '%p2health%'=='-100' goto p1win
if '%p2health%'=='-200' goto p1win
if '%p2health%'=='-300' goto p1win
goto p2gameplay
:nop1nuke
echo.
echo You can't use a nuke since you don't have any more left!
echo.
pause
goto p1gameplay
:p1airstrike
cls
if '%p1airstrike%'=='0' goto nop1airstrike
echo.
echo %p1name% has fired an airstrike on %p2country%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %p2country% has lost 300 DEF!
echo.
pause
set /a p2health=%p2health% - 300
set /a p1airstrike=%p1airstrike% - 1
if '%p2health%'=='0' goto p1win
if '%p2health%'=='-100' goto p1win
if '%p2health%'=='-200' goto p1win
if '%p2health%'=='-300' goto p1win
goto p2gameplay
:nop1airstrike
echo.
echo You can't use an airstrike since you don't have any more left!
echo.
pause
goto p1gameplay
:p1missiles
cls
if '%p1missiles%'=='0' goto nop1missiles
echo.
echo %p1name% has fired multiple missiles headed towards %p2country%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %p2country% has lost 200 DEF!
echo.
pause
set /a p2health=%p2health% - 200
set /a p1missiles=%p1missiles% - 1
if '%p2health%'=='0' goto p1win
if '%p2health%'=='-100' goto p1win
if '%p2health%'=='-200' goto p1win
if '%p2health%'=='-300' goto p1win
goto p2gameplay
:nop1missiles
echo.
echo You can't use missiles since you don't have any more left!
echo.
pause
goto p1gameplay
:p1surrender
cls
echo.
echo %p2name% has won Total War!!!
echo.
pause
:p1surrender2
cls
echo.
echo %p2name% has won Total War!!!
echo.
set /p replay=Type anything to replay the game. Type 'x' to exit:
if '%replay%'=='x' goto suggest
if '%replay%'=='' goto p1surrender2
goto players
:p1win
cls
echo.
echo %p1name% has won Total War!!!
echo.
pause
:p1win2
cls
echo.
echo %p1name% has won Total War!!!
echo.
set /p replay=Type anything to replay the game. Type 'x' to exit:
if '%replay%'=='x' goto suggest
if '%replay%'=='' goto p1win2
goto players
:p2gameplay
cls
set move=
set choice=
echo.
echo %p2name%, your turn.
echo                                                               %p2country%: %p2health% DEF
echo Options:
echo                                                               %p1country%: %p1health% DEF
echo 1. Fire NUKE x %p2nuke%
echo.
echo 2. Fire Airstrike x %p2airstrike%
echo.
echo 3. Fire Missiles x %p2missiles%
echo.
echo 4. Surrender
echo.
echo 5. Do nothing
echo.
set /p move=Select your option:
if '%move%'=='1' goto p2nuke
if '%move%'=='2' goto p2airstrike
if '%move%'=='3' goto p2missiles
if '%move%'=='4' goto p2surrender
if '%move%'=='5' goto p1gameplay
goto p2gameplay
:p2nuke
cls
if '%p2nuke%'=='0' goto nop2nuke
echo.
echo %p2name% has fired a NUKE headed towards %p1country%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %p1country% has lost 400 DEF!
echo.
pause
set /a p1health=%p1health% - 400
set p2nuke=0
if '%p1health%'=='0' goto p2win
if '%p1health%'=='-100' goto p2win
if '%p1health%'=='-200' goto p2win
if '%p1health%'=='-300' goto p2win
goto p1gameplay
:nop2nuke
echo.
echo You can't use a nuke since you don't have any more left!
echo.
pause
goto p2gameplay
:p2airstrike
cls
if '%p2airstrike%'=='0' goto nop2airstrike
echo.
echo %p2name% has fired an airstrike on %p1country%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %p1country% has lost 300 DEF!
echo.
pause
set /a p1health=%p1health% - 300
set /a p2airstrike=%p2airstrike% - 1
if '%p1health%'=='0' goto p2win
if '%p1health%'=='-100' goto p2win
if '%p1health%'=='-200' goto p2win
if '%p1health%'=='-300' goto p2win
goto p1gameplay
:nop2airstrike
echo.
echo You can't use an airstrike since you don't have any more left!
echo.
pause
goto p2gameplay
:p2missiles
cls
if '%p2missiles%'=='0' goto nop2missiles
echo.
echo %p2name% has fired multiple missiles headed towards %p1country%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %p1country% has lost 200 DEF!
echo.
pause
set /a p1health=%p1health% - 200
set /a p2missiles=%p2missiles% - 1
if '%p1health%'=='0' goto p2win
if '%p1health%'=='-100' goto p2win
if '%p1health%'=='-200' goto p2win
if '%p1health%'=='-300' goto p2win
goto p1gameplay
:nop2missiles
echo.
echo You can't use missiles since you don't have any more left!
echo.
pause
goto p2gameplay
:p2surrender
cls
echo.
echo %p1name% has won Total War!!!
echo.
pause
:p2surrender2
cls
echo.
echo %p1name% has won Total War!!!
echo.
set /p replay=Type anything to replay the game. Type 'x' to exit:
if '%replay%'=='x' goto suggest
if '%replay%'=='' goto p2surrender2
goto players
:p2win
cls
echo.
echo %p2name% has won Total War!!!
echo.
pause
:p2win2
cls
echo.
echo %p2name% has won Total War!!!
echo.
set /p replay=Type anything to replay the game. Type 'x' to exit:
if '%replay%'=='x' goto suggest
if '%replay%'=='' goto p2win2
goto players
:suggest
cls
echo.
echo Before you leave, can you suggest a country I can add to the file?
echo.
set /p suggestion=Suggest a country here:
if '%suggestion%'=='' goto suggest
echo %suggestion% >> suggestions.txt

Comments

author
MicahC7 (author)2017-01-20

Why does it crash whenever i input a number??!!

@echo off
color de
title Micah's TRIVIA
echo.
echo ---------------
echo.
echo Welcome to Micah's TRIVIA!!!!!
echo.
echo ---------------
echo.

set lives=3

pause
cls

:question1

echo lives=%lives%

echo Question 1:


echo What Is My Middle Name?
echo.
echo ---------------
echo.
echo 1. John
echo 2. Randell
echo 3. Andre

set /p MiddleName =C:/

if %MiddleName%==1 goto incorrect1
if %Middlename%==2 goto correct1
if %Middlename%==3 goto incorrect1
goto incorrect1

:incorrect1
cls
echo That was an incorrect answer!
pause
goto question1

:Correct1
cls
echo Thats right!!
pause

author
RichieU3 (author)MicahC72017-07-26

It is the codeing u forgot the spaces

ex:
If %num% == 1 goto incorrect1

If %num% == 2 goto correct1

If %num% == 3 goto incorrect1

:)

author
clint.collins (author)2017-02-17

thanks i love this game it seems to run perfectly

author
Assualtman99 (author)2017-02-03

Why won't the game let me play? It opens the window then it closes

author
BarnabasB4 (author)2017-01-12

One attack you should add is Hack. It makes them other player lose his turn and deals 50 damage.

author
BarnabasB4 (author)2017-01-12

You should make a WWI/WWII version.

Countries to add: China, Japan, France, Germany, England.

Features to add: You should add an option to change the text color.

Power-Ups: Some power ups to give added health or something like that.

You should add more attacks.

author
Destructables999 (author)2016-12-09

Can you add Germany into the game

author
jordanlong1246 (author)2016-09-21

;( pls tell me

author
jordanlong1246 made it! (author)2016-09-21

how do i play the game ?

arkkkkkkkkkkkkk.jpg
author
BatchGenius0817 (author)2014-12-02

Use color 8e... Looks really nice... Its yellow text on a light gray background... I'm currently working on my own war based game called "Nuclear Warfare" and have that as my color... looks great and easy to read

author

i have a problem with this naruto batch file i was trying to mess with can you help??

author
MatthewE31 (author)2016-03-01

Here is my version of the game, in a MLG theme.

@echo off
color 2F
title MLG Fighting
echo.
echo Welcome to MLG Fighting, created by Vincent Allain, edited by Matthew Evan to
echo make MLG Fighting.
echo.
echo (Origional Game Name Was Total War)
pause
:players
cls
set player=
set replay=
echo.
set /p player=Select 1 or 2 player mode:
if '%player%'=='1' goto name
if '%player%'=='2' goto p1name
goto players
:name
cls
set name=
echo.
set /p name=Please type in your name (One word):
if '%name%'=='' goto name
rem Easter Egg:
if '%name%'=='Vincent' goto win
if '%name%'=='Nitro' goto win
:country
cls
set country=
set enemy=
echo.
echo Welcome %name%!
echo.
set /p country=Choose your person; SnoopDogg, Lenny, or Shrek:
if '%country%'=='snoopdogg' goto enemy1
if '%country%'=='SnoopDogg' goto enemy1
if '%country%'=='Snoopdogg' goto enemy1
if '%country%'=='Lenny' goto enemy2
if '%country%'=='lenny' goto enemy2
if '%country%'=='Shrek' goto enemy3
if '%country%'=='shrek' goto enemy3
goto country
:enemy1
set country=SnoopDogg
goto enemy
:enemy2
set country=Lenny
goto enemy
:enemy3
set country=Shrek
:enemy
set /a cpucountryrand=%random% %%5 +1
if '%cpucountryrand%'=='0' goto enemy
if '%cpucountryrand%'=='1' set enemy=Lenny
if '%cpucountryrand%'=='2' set enemy=SnoopDogg
if '%cpucountryrand%'=='3' set enemy=Shrek
if '%cpucountryrand%'=='4' goto enemy
if '%cpucountryrand%'=='5' goto enemy
if '%enemy%'=='%country%' goto enemy
:begin
set user=1000
set cpu=1000
set nuke=1
set airstrike=2
set missiles=3
set cpunuke=1
set cpuairstrike=2
set cpumissiles=3
:gameplay
cls
set move=
set choice=
set cpucount=0
echo.
echo %name%, your turn.
echo %country%: %user% HP
echo Options:
echo %enemy%: %cpu% HP
echo 1. Drink Mtn Dew x %nuke%
echo.
echo 2. Noscope x %airstrike%
echo.
echo 3. Throw Bomb x %missiles%
echo.
echo 4. Surrender
echo.
echo 5. Do nothing
echo.
set /p move=Select your option:
if '%move%'=='1' goto nuke
if '%move%'=='2' goto airstrike
if '%move%'=='3' goto missiles
if '%move%'=='4' goto surrender
if '%move%'=='5' goto cpu1
goto gameplay
:nuke
cls
if '%nuke%'=='0' goto nonuke
echo.
echo %name% has drank a Mtn Dew, and threw the can toward's %enemy%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %enemy% has lost 400 HP!
echo.
pause
set /a cpu=%cpu% - 400
set nuke=0
if '%cpu%'=='0' goto win
if '%cpu%'=='-100' goto win
if '%cpu%'=='-200' goto win
if '%cpu%'=='-300' goto win
goto cpu1
:nonuke
echo.
echo You can't drink a Mtn Dew since you don't have any more left!
echo.
pause
goto gameplay
:airstrike
cls
if '%airstrike%'=='0' goto noairstrike
echo.
echo %name% has attemted to noscope %enemy%!
echo.
ping localhost -n 4 >nul
echo Get Rect!
echo.
echo %enemy% has lost 300 HP!
echo.
pause
set /a cpu=%cpu% - 300
set /a airstrike=%airstrike% - 1
if '%cpu%'=='0' goto win
if '%cpu%'=='-100' goto win
if '%cpu%'=='-200' goto win
if '%cpu%'=='-300' goto win
goto cpu1
:noairstrike
echo.
echo You can't noscope since you don't have any more bullets left!
echo.
pause
goto gameplay
:missiles
cls
if '%missiles%'=='0' goto nomissiles
echo.
echo %name% has thrown a bomb headed towards the %enemy%!
echo.
ping localhost -n 4 >nul
echo Kaboom!
echo.
echo %enemy% has lost 200 HP!
echo.
pause
set /a cpu=%cpu% - 200
set /a missiles=%missiles% - 1
if '%cpu%'=='0' goto win
if '%cpu%'=='-100' goto win
if '%cpu%'=='-200' goto win
if '%cpu%'=='-300' goto win
goto cpu1
:nomissiles
echo.
echo You can't use bombs since you don't have any more left!
echo.
pause
goto gameplay
:surrender
cls
echo.
echo "I may have lost the battle, but I still have our deritos..."
echo.
pause
:end
cls
echo.
echo "I may have lost the battle, but I still have our deritos..."
echo.
set /p replay=Type anything to replay the game. Type 'x' to exit:
if '%replay%'=='x' goto suggest
if '%replay%'=='' goto end
goto players
:win
cls
echo.
echo You have won!!!
echo.
pause
:win2
cls
echo.
echo You have won!!!
echo.
set /p replay=Type anything to replay the game. Type 'x' to exit:
if '%replay%'=='x' goto suggest
if '%replay%'=='' goto win2
goto players
:cpu1
cls
set /a cpucount=%cpucount% + 1
if '%cpucount%'=='10' goto cpu2
echo.
echo My turn.
echo %country%: %user% HP
echo Options:
echo %enemy%: %cpu% HP
echo 1. Drink Mtn Dew x %cpunuke%
echo.
echo 2. Noscope x %cpuairstrike%
echo.
echo 3. Throw Bomb x %cpumissiles%
echo.
echo 4. Surrender
echo.
echo 5. Do nothing
echo.
echo Select your option:/
ping localhost -n 1 >nul
ping localhost -n 1 >nul
ping localhost -n 1 >nul
ping localhost -n 1 >nul
cls
echo.
echo My turn.
echo %country%: %user% HP
echo Options:
echo %enemy%: %cpu% HP
echo 1. Drink Mtn Dew x %cpunuke%
echo.
echo 2. Noscope x %cpuairstrike%
echo.
echo 3. Throw Bomb x %cpumissiles%
echo.
echo 4. Surrender
echo.
echo 5. Do nothing
echo.
echo Select your option:-
ping localhost -n 1 >nul
ping localhost -n 1 >nul
ping localhost -n 1 >nul
ping localhost -n 1 >nul
cls
echo.
echo My turn.
echo %country%: %user% HP
echo Options:
echo %enemy%: %cpu% HP
echo 1. Drink Mtn Dew x %cpunuke%
echo.
echo 2. Noscope x %cpuairstrike%
echo.
echo 3. Throw Bomb x %cpumissiles%
echo.
echo 4. Surrender
echo.
echo 5. Do nothing
echo.
echo Select your option:\
ping localhost -n 1 >nul
ping localhost -n 1 >nul
ping localhost -n 1 >nul
ping localhost -n 1 >nul
goto cpu1
:cpu2
cls
set /a choice=%random% %%6
if '%choice%'=='0' goto cpu2
if '%choice%'=='4' goto cpu2
if '%choice%'=='6' goto cpu2
echo.
echo My turn.
echo %country%: %user% HP
echo Options:
echo %enemy%: %cpu% HP
echo 1. Drink Mtn Dew x %cpunuke%
echo.
echo 2. Noscope x %cpuairstrike%
echo.
echo 3. Throw Bomb x %cpumissiles%
echo.
echo 4. Surrender
echo.
echo 5. Do nothing
echo.
echo Select your option:%choice%
ping localhost -n 4 >nul
if '%choice%'=='1' goto cpunuke
if '%choice%'=='2' goto cpuairstrike
if '%choice%'=='3' goto cpumissiles
if '%choice%'=='5' goto gameplay
:cpunuke
cls
if '%cpunuke%'=='0' goto nocpunuke
echo.
echo I have drank a Mtn Dew and threw the can towards %country%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %country% has lost 400 HP!
echo.
ping localhost -n 4 >nul
set /a user=%user% - 400
set cpunuke=0
if '%user%'=='0' goto cpuwin
if '%user%'=='-100' goto cpuwin
if '%user%'=='-200' goto cpuwin
if '%user%'=='-300' goto cpuwin
goto gameplay
:nocpunuke
echo.
echo I can't drink a Mtn Dew since I don't have any more left!
echo.
ping localhost -n 4 >nul
set cpucount=0
goto cpu1
:cpuairstrike
cls
if '%cpuairstrike%'=='0' goto nocpuairstrike
echo.
echo I have thrown a bomb headed towards %country%!
echo.
ping localhost -n 4 >nul
echo Kaboom!
echo.
echo %country% has lost 300 HP!
echo.
ping localhost -n 4 >nul
set /a user=%user% - 300
set /a cpuairstrike=%cpuairstrike% - 1
if '%user%'=='0' goto cpuwin
if '%user%'=='-100' goto cpuwin
if '%user%'=='-200' goto cpuwin
if '%user%'=='-300' goto cpuwin
goto gameplay
:nocpuairstrike
echo.
echo I can't noscope since I don't have any more bullets left!
echo.
ping localhost -n 4 >nul
set cpucount=0
goto cpu1
:cpumissiles
cls
if '%cpumissiles%'=='0' goto nocpumissiles
echo.
echo I have thrown a bomb headed towards %country%!
echo.
ping localhost -n 4 >nul
echo Kaboom!
echo.
echo %country% has lost 200 HP!
echo.
ping localhost -n 4 >nul
set /a user=%user% - 200
set /a cpumissiles=%cpumissiles% - 1
if '%user%'=='0' goto cpuwin
if '%user%'=='-100' goto cpuwin
if '%user%'=='-200' goto cpuwin
if '%user%'=='-300' goto cpuwin
goto gameplay
:nocpumissiles
echo.
echo I can't use bombs since I don't have any more left!
echo.
ping localhost -n 4 >nul
set cpucount=0
goto cpu1
:cpuwin
cls
echo.
echo It was a long battle today. I have emerged victorious, even though you tried
echo to noscope me many times.
echo.
pause
:cpuwin2
cls
echo.
echo It was a long battle today. I have emerged victorious, even though you tried
echo to noscope me many times.
echo.
set /p replay=Type anything to replay the game. Type 'x' to exit:
if '%replay%'=='x' goto suggest
if '%replay%'=='' goto cpuwin2
goto players
:p1name
cls
set p1name=
echo.
set /p p1name=Player 1, please type in your name (One word):
if '%p1name%'=='' goto p1name
:p2name
cls
set p2name=
echo.
set /p p2name=Player 2, please type in your name (One word):
if '%p2name%'=='%p1name%' goto p2name
if '%p2name%'=='' goto p2name
rem Easter Egg:
if '%p1name%'=='Nitro' goto p1win
if '%p2name%'=='Nitro' goto p2win
:p1country
cls
set p1country=
echo.
echo Welcome %p1name%!
echo.
set /p p1country=Choose your person; SnoopDogg, Lenny, or Shrek:
if '%p1country%'=='snoopdogg' goto p1country1
if '%p1country%'=='SnoopDogg' goto p1country1
if '%p1country%'=='Snoopdogg' goto p1country1
if '%p1country%'=='Lenny' goto p1country2
if '%p1country%'=='lenny' goto p1country2
if '%p1country%'=='shrek' goto p1country3
if '%p1country%'=='Shrek' goto p1country3
goto p1country
:p1country1
set p1country=Snoop Dogg
goto p2country
:p1country2
set p1country=Lenny
goto p2country
:p1country3
set p1country=Shrek
:p2country
cls
set p2country=
echo.
echo Welcome %p2name%!
echo.
set /p p2country=Choose your person; SnoopDogg, Lenny, or Shrek:
if '%p2country%'=='%p1country%' goto na
if '%p2country%'=='snoopdogg' goto p2country1
if '%p2country%'=='Snoopdogg' goto p2country1
if '%p2country%'=='SnoopDogg' goto p2country1
if '%p2country%'=='Lenny' goto p2country2
if '%p2country%'=='lenny' goto p2country2
if '%p2country%'=='shrek' goto p2country3
if '%p2country%'=='Shrek' goto p2country3
goto p2country
:na
cls
echo.
echo You can't choose %p1country% because %p1name% has already chosen him.
pause >nul
goto p2country
:p2country1
set p2country=Snoop Dogg
goto begin2
:p2country2
set p2country=Lenny
goto begin2
:p2country3
set p2country=Shrek
:begin2
set p1health=1000
set p2health=1000
set p1nuke=1
set p1airstrike=2
set p1missiles=3
set p2nuke=1
set p2airstrike=2
set p2missiles=3
:p1gameplay
cls
set move=
set choice=
echo.
echo %p1name%, your turn.
echo %p1country%: %p1health% HP
echo Options:
echo %p2country%: %p2health% HP
echo 1. Drink Mtn Dew x %p1nuke%
echo.
echo 2. Noscope x %p1airstrike%
echo.
echo 3. Throw Bombs x %p1missiles%
echo.
echo 4. Surrender
echo.
echo 5. Do nothing
echo.
set /p move=Select your option:
if '%move%'=='1' goto p1nuke
if '%move%'=='2' goto p1airstrike
if '%move%'=='3' goto p1missiles
if '%move%'=='4' goto p1surrender
if '%move%'=='5' goto p2gameplay
goto p1gameplay
:p1nuke
cls
if '%p1nuke%'=='0' goto nop1nuke
echo.
echo %p1name% has drank a Mtn Dew and threw the can towards %p2country%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %p2country% has lost 400 HP!
echo.
pause
set /a p2health=%p2health% - 400
set p1nuke=0
if '%p2health%'=='0' goto p1win
if '%p2health%'=='-100' goto p1win
if '%p2health%'=='-200' goto p1win
if '%p2health%'=='-300' goto p1win
goto p2gameplay
:nop1nuke
echo.
echo You can't drink a Mtn Dew since you don't have any more left!
echo.
pause
goto p1gameplay
:p1airstrike
cls
if '%p1airstrike%'=='0' goto nop1airstrike
echo.
echo %p1name% has attemted to noscope %p2country%!
echo.
ping localhost -n 4 >nul
echo Gotie!
echo.
echo %p2country% has lost 300 HP!
echo.
pause
set /a p2health=%p2health% - 300
set /a p1airstrike=%p1airstrike% - 1
if '%p2health%'=='0' goto p1win
if '%p2health%'=='-100' goto p1win
if '%p2health%'=='-200' goto p1win
if '%p2health%'=='-300' goto p1win
goto p2gameplay
:nop1airstrike
echo.
echo You can't noscope since you don't have any more bullets left!
echo.
pause
goto p1gameplay
:p1missiles
cls
if '%p1missiles%'=='0' goto nop1missiles
echo.
echo %p1name% has attemted to noscope %p2country%!
echo.
ping localhost -n 4 >nul
echo Gotie!
echo.
echo %p2country% has lost 200 HP!
echo.
pause
set /a p2health=%p2health% - 200
set /a p1missiles=%p1missiles% - 1
if '%p2health%'=='0' goto p1win
if '%p2health%'=='-100' goto p1win
if '%p2health%'=='-200' goto p1win
if '%p2health%'=='-300' goto p1win
goto p2gameplay
:nop1missiles
echo.
echo You can't noscope since you don't have any more bullets left!
echo.
pause
goto p1gameplay
:p1surrender
cls
echo.
echo %p2name% has won!!!
echo.
pause
:p1surrender2
cls
echo.
echo %p2name% has won!!!
echo.
set /p replay=Type anything to replay the game. Type 'x' to exit:
if '%replay%'=='x' goto suggest
if '%replay%'=='' goto p1surrender2
goto players
:p1win
cls
echo.
echo %p1name% has won!!!
echo.
pause
:p1win2
cls
echo.
echo %p1name% has won!!!
echo.
set /p replay=Type anything to replay the game. Type 'x' to exit:
if '%replay%'=='x' goto suggest
if '%replay%'=='' goto p1win2
goto players
:p2gameplay
cls
set move=
set choice=
echo.
echo %p2name%, your turn.
echo %p2country%: %p2health% HP
echo Options:
echo %p1country%: %p1health% HP
echo 1. Drink Mtn Dew x %p2nuke%
echo.
echo 2. Noscope x %p2airstrike%
echo.
echo 3. Throw Bombs x %p2missiles%
echo.
echo 4. Surrender
echo.
echo 5. Do nothing
echo.
set /p move=Select your option:
if '%move%'=='1' goto p2nuke
if '%move%'=='2' goto p2airstrike
if '%move%'=='3' goto p2missiles
if '%move%'=='4' goto p2surrender
if '%move%'=='5' goto p1gameplay
goto p2gameplay
:p2nuke
cls
if '%p2nuke%'=='0' goto nop2nuke
echo.
echo %p2name% has drank a Mtn Dew and threw a can headed towards %p1country%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %p1country% has lost 400 HP!
echo.
pause
set /a p1health=%p1health% - 400
set p2nuke=0
if '%p1health%'=='0' goto p2win
if '%p1health%'=='-100' goto p2win
if '%p1health%'=='-200' goto p2win
if '%p1health%'=='-300' goto p2win
goto p1gameplay
:nop2nuke
echo.
echo You can't use a Mtn Dew since you don't have any more left!
echo.
pause
goto p2gameplay
:p2airstrike
cls
if '%p2airstrike%'=='0' goto nop2airstrike
echo.
echo %p2name% has noscoped %p1country%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %p1country% has lost 300 HP!
echo.
pause
set /a p1health=%p1health% - 300
set /a p2airstrike=%p2airstrike% - 1
if '%p1health%'=='0' goto p2win
if '%p1health%'=='-100' goto p2win
if '%p1health%'=='-200' goto p2win
if '%p1health%'=='-300' goto p2win
goto p1gameplay
:nop2airstrike
echo.
echo You can't noscope since you don't have any bullets left!
echo.
pause
goto p2gameplay
:p2missiles
cls
if '%p2missiles%'=='0' goto nop2missiles
echo.
echo %p2name% has thrown bombs towards %p1country%!
echo.
ping localhost -n 4 >nul
echo Hit!
echo.
echo %p1country% has lost 200 HP!
echo.
pause
set /a p1health=%p1health% - 200
set /a p2missiles=%p2missiles% - 1
if '%p1health%'=='0' goto p2win
if '%p1health%'=='-100' goto p2win
if '%p1health%'=='-200' goto p2win
if '%p1health%'=='-300' goto p2win
goto p1gameplay
:nop2missiles
echo.
echo You can't use bombs since you don't have any more left!
echo.
pause
goto p2gameplay
:p2surrender
cls
echo.
echo %p1name% has won!!!
echo.
pause
:p2surrender2
cls
echo.
echo %p1name% has won!!!
echo.
set /p replay=Type anything to replay the game. Type 'x' to exit:
if '%replay%'=='x' goto suggest
if '%replay%'=='' goto p2surrender2
goto players
:p2win
cls
echo.
echo %p2name% has won!!!
echo.
pause
:p2win2
cls
echo.
echo %p2name% has won!!!
echo.
set /p replay=Type anything to replay the game. Type 'x' to exit:
if '%replay%'=='x' goto suggest
if '%replay%'=='' goto p2win2
goto players
:suggest
cls

author
MidgetCoder (author)2014-01-19

I Love This Batch Game, Soooo Much Fun.

Would You Mind If My friend And I Added A Few Things To It To Make It A Longer Lasting Game?

If You Say Yes We Will Credit You As The Original Maker.

Thanks, MidgetCoder Out

author

Go ahead! This was just a project I did on my free time, so if you modify it, I don't mind. Just remember to cite me.

author
TaylorL2 (author)BATCHFILEMASTER2014-10-07

I changed the code up a bit to make it more efficient, changed DEF amount to higher and increased weapon values, also added in a heal self option, to give yourself DEF as opposed to sending an attack... anyone wants my code im happy to share my improvments.

author

Could I get the code for that, I'd love to put it in 1.3!

author

I completely lost track of this instructable prob to late now but here is my version of the game here can download it here: https://app.box.com/s/uv9ervbgthbsodyli73az01gp7b2m8kt its old now prob way outdated to anything you may have done, my heal addons are called :healself & :noheal if you want just those elements, and of course need the corresponding set variables and options in the menus but im sure you know that.

author

Cheers man, thanks heaps we will definitely cite you,

Cheers MidgetCoder

author
ddogs196 (author)MidgetCoder2014-03-05

hay anyone know any batch files i can use cause i might be hacking a website called infinite campus if any one would like to join me / help me out I would be vary happy :)

ps here is a link

https://portal.swcs.us/campus/portal/southwestern.jsp

author
OwenS4 (author)ddogs1962015-02-10

No, people cannot hack a school grade keeping website with a batch file. You ten year olds don't even know what you mean when you say "hack".

author
luca0157 (author)2015-11-03

How do i run this, sorry I'm just a total noob with a general interest in these sort of this. I copy and pasted it into notepad++ and saved it as a batch file however that did not work... What do I do?

author
楊天 (author)luca01572015-11-13

try to use the noraml notepad.txt, copy it in, when you save you have to save as, and for example you wanna name it as"totalwar", you have o type "totalwar.bat", and select "all files"

author
xXJeff The KillerXx (author)2015-05-19

I've created Version 1.2.1, a minor patch, but it fixes an issue that I found strange. It basically just allows your text to change back to its default setting after losing or winning a war, and it also includes an update log/changelog!

@echo off

color 0f

title TOTAL WAR!!!V1.2.1

echo.

echo Welcome to Total WarV1.2.1, created by Vincent Allain, edited by CreepKill2003.

echo UPDATE LOG- V1.2.1

echo -Will no longer keep your text color as green or red when you restart after winning or losing a match.

echo -We now have an update log!

echo.

pause

:players

color 0f

cls

set player=

set replay=

echo.

set /p player=Select 1 or 2 player mode:

if '%player%'=='1' goto name

if '%player%'=='2' goto p1name

goto players

:name

cls

set name=

echo.

set /p name=Please type in your name (One word):

if '%name%'=='' goto name

rem Easter Egg:

if '%name%'=='Vincent' goto win

if '%name%'=='CreepKill2003' goto win

:country

cls

set country=

set enemy=

echo.

echo Welcome %name%!

echo.

set /p country=Choose your country; USA, Russia, UK, or Canada:

if '%country%'=='usa' goto enemy1

if '%country%'=='USA' goto enemy1

if '%country%'=='Usa' goto enemy1

if '%country%'=='Russia' goto enemy2

if '%country%'=='russia' goto enemy2

if '%country%'=='canada' goto enemy3

if '%country%'=='Canada' goto enemy3

if '%country%'=='UK' goto enemy4

if '%country%'=='uk' goto enemy4

if '%country%'=='Uk' goto enemy4

goto country

:enemy1

set country=USA

goto enemy

:enemy2

set country=Russia

goto enemy

:enemy3

set country=Canada

:enemy4

set country=UK

:enemy

set /a cpucountryrand=%random% %%6 +1

if '%cpucountryrand%'=='0' goto enemy

if '%cpucountryrand%'=='1' set enemy=Russia

if '%cpucountryrand%'=='2' set enemy=USA

if '%cpucountryrand%'=='3' set enemy=Canada

if '%cpucountryrand%'=='4' set enemy=UK

if '%cpucountryrand%'=='5' goto enemy

if '%cpucountryrand%'=='6' goto enemy

if '%enemy%'=='%country%' goto enemy

:begin

set user=1000

set cpu=1000

set nuke=1

set airstrike=2

set missiles=3

set cpunuke=1

set cpuairstrike=2

set cpumissiles=3

:gameplay

cls

set move=

set choice=

set cpucount=0

echo.

echo %name%, your turn.

echo %country%: %user% DEF

echo Options:

echo %enemy%: %cpu% DEF

echo 1. Fire NUKE x %nuke%

echo.

echo 2. Fire Airstrike x %airstrike%

echo.

echo 3. Fire Missiles x %missiles%

echo.

echo 4. Surrender

echo.

echo 5. Do nothing

echo.

set /p move=Select your option:

if '%move%'=='1' goto nuke

if '%move%'=='2' goto airstrike

if '%move%'=='3' goto missiles

if '%move%'=='4' goto surrender

if '%move%'=='5' goto cpu1

goto gameplay

:nuke

cls

if '%nuke%'=='0' goto nonuke

echo.

echo %name% has fired a NUKE headed towards %enemy%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %enemy% has lost 400 DEF!

echo.

pause

set /a cpu=%cpu% - 400

set nuke=0

if '%cpu%'=='0' goto win

if '%cpu%'=='-100' goto win

if '%cpu%'=='-200' goto win

if '%cpu%'=='-300' goto win

goto cpu1

:nonuke

echo.

echo You can't use a nuke since you don't have any more left!

echo.

pause

goto gameplay

:airstrike

cls

if '%airstrike%'=='0' goto noairstrike

echo.

echo %name% has fired an airstrike on %enemy%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %enemy% has lost 300 DEF!

echo.

pause

set /a cpu=%cpu% - 300

set /a airstrike=%airstrike% - 1

if '%cpu%'=='0' goto win

if '%cpu%'=='-100' goto win

if '%cpu%'=='-200' goto win

if '%cpu%'=='-300' goto win

goto cpu1

:noairstrike

echo.

echo You can't use an airstrike since you don't have any more left!

echo.

pause

goto gameplay

:missiles

cls

if '%missiles%'=='0' goto nomissiles

echo.

echo %name% has fired multiple missiles headed towards %enemy%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %enemy% has lost 200 DEF!

echo.

pause

set /a cpu=%cpu% - 200

set /a missiles=%missiles% - 1

if '%cpu%'=='0' goto win

if '%cpu%'=='-100' goto win

if '%cpu%'=='-200' goto win

if '%cpu%'=='-300' goto win

goto cpu1

:nomissiles

echo.

echo You can't use missiles since you don't have any more left!

echo.

pause

goto gameplay

:surrender

color 0c

cls

echo.

echo "We may have lost the war, but we still have our dignity..."

echo.

pause

:end

cls

echo.

echo "We may have lost the war, but we still have our dignity..."

echo.

set /p replay=Type anything to replay the game. Type 'x' to exit:

if '%replay%'=='x' goto suggest

if '%replay%'=='' goto end

goto players

:win

color 02

cls

echo.

echo You have won Total War!!!

echo.

pause

:win2

cls

echo.

echo You have won Total War!!!

echo.

set /p replay=Type anything to replay the game. Type 'x' to exit:

if '%replay%'=='x' goto suggest

if '%replay%'=='' goto win2

goto players

:cpu1

cls

set /a cpucount=%cpucount% + 1

if '%cpucount%'=='10' goto cpu2

echo.

echo My turn.

echo %country%: %user% DEF

echo Options:

echo %enemy%: %cpu% DEF

echo 1. Fire NUKE x %cpunuke%

echo.

echo 2. Fire Airstrike x %cpuairstrike%

echo.

echo 3. Fire Missiles x %cpumissiles%

echo.

echo 4. Surrender

echo.

echo 5. Do nothing

echo.

echo Select your option:/

ping localhost -n 1 >nul

ping localhost -n 1 >nul

ping localhost -n 1 >nul

ping localhost -n 1 >nul

cls

echo.

echo My turn.

echo %country%: %user% DEF

echo Options:

echo %enemy%: %cpu% DEF

echo 1. Fire NUKE x %cpunuke%

echo.

echo 2. Fire Airstrike x %cpuairstrike%

echo.

echo 3. Fire Missiles x %cpumissiles%

echo.

echo 4. Surrender

echo.

echo 5. Do nothing

echo.

echo Select your option:-

ping localhost -n 1 >nul

ping localhost -n 1 >nul

ping localhost -n 1 >nul

ping localhost -n 1 >nul

cls

echo.

echo My turn.

echo %country%: %user% DEF

echo Options:

echo %enemy%: %cpu% DEF

echo 1. Fire NUKE x %cpunuke%

echo.

echo 2. Fire Airstrike x %cpuairstrike%

echo.

echo 3. Fire Missiles x %cpumissiles%

echo.

echo 4. Surrender

echo.

echo 5. Do nothing

echo.

echo Select your option:\

ping localhost -n 1 >nul

ping localhost -n 1 >nul

ping localhost -n 1 >nul

ping localhost -n 1 >nul

goto cpu1

:cpu2

cls

set /a choice=%random% %%6

if '%choice%'=='0' goto cpu2

if '%choice%'=='4' goto cpu2

if '%choice%'=='6' goto cpu2

echo.

echo My turn.

echo %country%: %user% DEF

echo Options:

echo %enemy%: %cpu% DEF

echo 1. Fire NUKE x %cpunuke%

echo.

echo 2. Fire Airstrike x %cpuairstrike%

echo.

echo 3. Fire Missiles x %cpumissiles%

echo.

echo 4. Surrender

echo.

echo 5. Do nothing

echo.

echo Select your option:%choice%

ping localhost -n 4 >nul

if '%choice%'=='1' goto cpunuke

if '%choice%'=='2' goto cpuairstrike

if '%choice%'=='3' goto cpumissiles

if '%choice%'=='5' goto gameplay

:cpunuke

cls

if '%cpunuke%'=='0' goto nocpunuke

echo.

echo I have fired a NUKE headed towards %country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %country% has lost 400 DEF!

echo.

ping localhost -n 4 >nul

set /a user=%user% - 400

set cpunuke=0

if '%user%'=='0' goto cpuwin

if '%user%'=='-100' goto cpuwin

if '%user%'=='-200' goto cpuwin

if '%user%'=='-300' goto cpuwin

goto gameplay

:nocpunuke

echo.

echo I can't use a nuke since I don't have any more left!

echo.

ping localhost -n 4 >nul

set cpucount=0

goto cpu1

:cpuairstrike

cls

if '%cpuairstrike%'=='0' goto nocpuairstrike

echo.

echo I have fired an airstrike on %country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %country% has lost 300 DEF!

echo.

ping localhost -n 4 >nul

set /a user=%user% - 300

set /a cpuairstrike=%cpuairstrike% - 1

if '%user%'=='0' goto cpuwin

if '%user%'=='-100' goto cpuwin

if '%user%'=='-200' goto cpuwin

if '%user%'=='-300' goto cpuwin

goto gameplay

:nocpuairstrike

echo.

echo I can't use an airstrike since I don't have any more left!

echo.

ping localhost -n 4 >nul

set cpucount=0

goto cpu1

:cpumissiles

cls

if '%cpumissiles%'=='0' goto nocpumissiles

echo.

echo I have fired multiple missiles headed towards %country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %country% has lost 200 DEF!

echo.

ping localhost -n 4 >nul

set /a user=%user% - 200

set /a cpumissiles=%cpumissiles% - 1

if '%user%'=='0' goto cpuwin

if '%user%'=='-100' goto cpuwin

if '%user%'=='-200' goto cpuwin

if '%user%'=='-300' goto cpuwin

goto gameplay

:nocpumissiles

echo.

echo I can't use missiles since I don't have any more left!

echo.

ping localhost -n 4 >nul

set cpucount=0

goto cpu1

:cpuwin

color 0c

cls

echo.

echo It was a long battle today. I have emerged victorious, even though you tried

echo very well.

echo.

pause

:cpuwin2

cls

echo.

echo It was a long battle today. I have emerged victorious, even though you tried

echo very well.

echo.

set /p replay=Type anything to replay the game. Type 'x' to exit:

if '%replay%'=='x' goto suggest

if '%replay%'=='' goto cpuwin2

goto players

:p1name

cls

set p1name=

echo.

set /p p1name=Player 1, please type in your name (One word):

if '%p1name%'=='' goto p1name

:p2name

cls

set p2name=

echo.

set /p p2name=Player 2, please type in your name (One word):

if '%p2name%'=='%p1name%' goto p2name

if '%p2name%'=='' goto p2name

rem Easter Egg:

if '%p1name%'=='Vincent' goto p1win

if '%p2name%'=='Vincent' goto p2win

:p1country

cls

set p1country=

echo.

echo Welcome %p1name%!

echo.

set /p p1country=Choose your country; USA, Russia, or Canada:

if '%p1country%'=='usa' goto p1country1

if '%p1country%'=='USA' goto p1country1

if '%p1country%'=='Usa' goto p1country1

if '%p1country%'=='Russia' goto p1country2

if '%p1country%'=='russia' goto p1country2

if '%p1country%'=='canada' goto p1country3

if '%p1country%'=='Canada' goto p1country3

if '%p1country%'=='UK' got p1country4

if '%p1country%'=='uk' got p1country4

if '%p1country%'=='Uk' got p1country4

goto p1country

:p1country1

set p1country=USA

goto p2country

:p1country2

set p1country=Russia

goto p2country

:p1country3

set p1country=Canada

:p1country4

set p1country=UK

:p2country

cls

set p2country=

echo.

echo Welcome %p2name%!

echo.

set /p p2country=Choose your country; USA, Russia, UK, or Canada:

if '%p2country%'=='%p1country%' goto na

if '%p2country%'=='usa' goto p2country1

if '%p2country%'=='USA' goto p2country1

if '%p2country%'=='Usa' goto p2country1

if '%p2country%'=='Russia' goto p2country2

if '%p2country%'=='russia' goto p2country2

if '%p2country%'=='canada' goto p2country3

if '%p2country%'=='Canada' goto p2country3

if '%p2country%'=='UK' got p2country4

if '%p2country%'=='uk' got p2country4

if '%p2country%'=='Uk' got p2country4

goto p2country

:na

cls

echo.

echo You can't choose %p1country% because %p1name% has already chosen it.

pause >nul

goto p2country

:p2country1

set p2country=USA

goto begin2

:p2country2

set p2country=Russia

goto begin2

:p2country3

set p2country=Canada

goto begin2

:p2country4

set p2country=UK

goto begin2

:begin2

set p1health=1000

set p2health=1000

set p1nuke=1

set p1airstrike=2

set p1missiles=3

set p2nuke=1

set p2airstrike=2

set p2missiles=3

:p1gameplay

cls

set move=

set choice=

echo.

echo %p1name%, your turn.

echo %p1country%: %p1health% DEF

echo Options:

echo %p2country%: %p2health% DEF

echo 1. Fire NUKE x %p1nuke%

echo.

echo 2. Fire Airstrike x %p1airstrike%

echo.

echo 3. Fire Missiles x %p1missiles%

echo.

echo 4. Surrender

echo.

echo 5. Do nothing

echo.

set /p move=Select your option:

if '%move%'=='1' goto p1nuke

if '%move%'=='2' goto p1airstrike

if '%move%'=='3' goto p1missiles

if '%move%'=='4' goto p1surrender

if '%move%'=='5' goto p2gameplay

goto p1gameplay

:p1nuke

cls

if '%p1nuke%'=='0' goto nop1nuke

echo.

echo %p1name% has fired a NUKE headed towards %p2country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %p2country% has lost 400 DEF!

echo.

pause

set /a p2health=%p2health% - 400

set p1nuke=0

if '%p2health%'=='0' goto p1win

if '%p2health%'=='-100' goto p1win

if '%p2health%'=='-200' goto p1win

if '%p2health%'=='-300' goto p1win

goto p2gameplay

:nop1nuke

echo.

echo You can't use a nuke since you don't have any more left!

echo.

pause

goto p1gameplay

:p1airstrike

cls

if '%p1airstrike%'=='0' goto nop1airstrike

echo.

echo %p1name% has fired an airstrike on %p2country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %p2country% has lost 300 DEF!

echo.

pause

set /a p2health=%p2health% - 300

set /a p1airstrike=%p1airstrike% - 1

if '%p2health%'=='0' goto p1win

if '%p2health%'=='-100' goto p1win

if '%p2health%'=='-200' goto p1win

if '%p2health%'=='-300' goto p1win

goto p2gameplay

:nop1airstrike

echo.

echo You can't use an airstrike since you don't have any more left!

echo.

pause

goto p1gameplay

:p1missiles

cls

if '%p1missiles%'=='0' goto nop1missiles

echo.

echo %p1name% has fired multiple missiles headed towards %p2country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %p2country% has lost 200 DEF!

echo.

pause

set /a p2health=%p2health% - 200

set /a p1missiles=%p1missiles% - 1

if '%p2health%'=='0' goto p1win

if '%p2health%'=='-100' goto p1win

if '%p2health%'=='-200' goto p1win

if '%p2health%'=='-300' goto p1win

goto p2gameplay

:nop1missiles

echo.

echo You can't use missiles since you don't have any more left!

echo.

pause

goto p1gameplay

:p1surrender

color 02

cls

echo.

echo %p2name% has won Total War!!!

echo.

pause

:p1surrender2

cls

echo.

echo %p2name% has won Total War!!!

echo.

set /p replay=Type anything to replay the game. Type 'x' to exit:

if '%replay%'=='x' goto suggest

if '%replay%'=='' goto p1surrender2

goto players

:p1win

color 02

cls

echo.

echo %p1name% has won Total War!!!

echo.

pause

:p1win2

cls

echo.

echo %p1name% has won Total War!!!

echo.

set /p replay=Type anything to replay the game. Type 'x' to exit:

if '%replay%'=='x' goto suggest

if '%replay%'=='' goto p1win2

goto players

:p2gameplay

cls

set move=

set choice=

echo.

echo %p2name%, your turn.

echo %p2country%: %p2health% DEF

echo Options:

echo %p1country%: %p1health% DEF

echo 1. Fire NUKE x %p2nuke%

echo.

echo 2. Fire Airstrike x %p2airstrike%

echo.

echo 3. Fire Missiles x %p2missiles%

echo.

echo 4. Surrender

echo.

echo 5. Do nothing

echo.

set /p move=Select your option:

if '%move%'=='1' goto p2nuke

if '%move%'=='2' goto p2airstrike

if '%move%'=='3' goto p2missiles

if '%move%'=='4' goto p2surrender

if '%move%'=='5' goto p1gameplay

goto p2gameplay

:p2nuke

cls

if '%p2nuke%'=='0' goto nop2nuke

echo.

echo %p2name% has fired a NUKE headed towards %p1country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %p1country% has lost 400 DEF!

echo.

pause

set /a p1health=%p1health% - 400

set p2nuke=0

if '%p1health%'=='0' goto p2win

if '%p1health%'=='-100' goto p2win

if '%p1health%'=='-200' goto p2win

if '%p1health%'=='-300' goto p2win

goto p1gameplay

:nop2nuke

echo.

echo You can't use a nuke since you don't have any more left!

echo.

pause

goto p2gameplay

:p2airstrike

cls

if '%p2airstrike%'=='0' goto nop2airstrike

echo.

echo %p2name% has fired an airstrike on %p1country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %p1country% has lost 300 DEF!

echo.

pause

set /a p1health=%p1health% - 300

set /a p2airstrike=%p2airstrike% - 1

if '%p1health%'=='0' goto p2win

if '%p1health%'=='-100' goto p2win

if '%p1health%'=='-200' goto p2win

if '%p1health%'=='-300' goto p2win

goto p1gameplay

:nop2airstrike

echo.

echo You can't use an airstrike since you don't have any more left!

echo.

pause

goto p2gameplay

:p2missiles

cls

if '%p2missiles%'=='0' goto nop2missiles

echo.

echo %p2name% has fired multiple missiles headed towards %p1country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %p1country% has lost 200 DEF!

echo.

pause

set /a p1health=%p1health% - 200

set /a p2missiles=%p2missiles% - 1

if '%p1health%'=='0' goto p2win

if '%p1health%'=='-100' goto p2win

if '%p1health%'=='-200' goto p2win

if '%p1health%'=='-300' goto p2win

goto p1gameplay

:nop2missiles

echo.

echo You can't use missiles since you don't have any more left!

echo.

pause

goto p2gameplay

:p2surrender

color 02

cls

echo.

echo %p1name% has won Total War!!!

echo.

pause

:p2surrender2

cls

echo.

echo %p1name% has won Total War!!!

echo.

set /p replay=Type anything to replay the game. Type 'x' to exit:

if '%replay%'=='x' goto suggest

if '%replay%'=='' goto p2surrender2

goto players

color 02

:p2win

cls

echo.

echo %p2name% has won Total War!!!

echo.

pause

:p2win2

cls

echo.

echo %p2name% has won Total War!!!

echo.

set /p replay=Type anything to replay the game. Type 'x' to exit:

if '%replay%'=='x' goto suggest

if '%replay%'=='' goto p2win2

goto players

:suggest

cls

echo.

echo Before you leave, can you suggest a country I can add to the file?

echo.

set /p suggestion=Suggest a country here:

if '%suggestion%'=='' goto suggest

echo %suggestion% >> suggestions.txt

author

Nice

author
I_boom5245 (author)2015-10-11

Nice!!!!

author
Stan2000 (author)2013-12-03

Nice .bat file only not any good graphics, as always with batch

author

Well, .bat or batch files are run with cmd, which is basically just a control panel to help you control different settings on your computer, and isn't exactly MADE to run games, but still can be made to.

author
xXJeff The KillerXx made it! (author)2015-05-18

Hey, this is a great game, and me, being a tech guy, I messed around with the coding, and ended up doing this.

@echo off

color 0f

title TOTAL WAR!!!V1.2

echo.

echo Welcome to Total WarV1.2, created by Vincent Allain, edited by CreepKill2003.

echo.

pause

:players

cls

set player=

set replay=

echo.

set /p player=Select 1 or 2 player mode:

if '%player%'=='1' goto name

if '%player%'=='2' goto p1name

goto players

:name

cls

set name=

echo.

set /p name=Please type in your name (One word):

if '%name%'=='' goto name

rem Easter Egg:

if '%name%'=='Vincent' goto win

if '%name%'=='CreepKill2003' goto win

:country

cls

set country=

set enemy=

echo.

echo Welcome %name%!

echo.

set /p country=Choose your country; USA, Russia, UK, or Canada:

if '%country%'=='usa' goto enemy1

if '%country%'=='USA' goto enemy1

if '%country%'=='Usa' goto enemy1

if '%country%'=='Russia' goto enemy2

if '%country%'=='russia' goto enemy2

if '%country%'=='canada' goto enemy3

if '%country%'=='Canada' goto enemy3

if '%country%'=='UK' goto enemy4

if '%country%'=='uk' goto enemy4

if '%country%'=='Uk' goto enemy4

goto country

:enemy1

set country=USA

goto enemy

:enemy2

set country=Russia

goto enemy

:enemy3

set country=Canada

:enemy4

set country=UK

:enemy

set /a cpucountryrand=%random% %%6 +1

if '%cpucountryrand%'=='0' goto enemy

if '%cpucountryrand%'=='1' set enemy=Russia

if '%cpucountryrand%'=='2' set enemy=USA

if '%cpucountryrand%'=='3' set enemy=Canada

if '%cpucountryrand%'=='4' set enemy=UK

if '%cpucountryrand%'=='5' goto enemy

if '%cpucountryrand%'=='6' goto enemy

if '%enemy%'=='%country%' goto enemy

:begin

set user=1000

set cpu=1000

set nuke=1

set airstrike=2

set missiles=3

set cpunuke=1

set cpuairstrike=2

set cpumissiles=3

:gameplay

cls

set move=

set choice=

set cpucount=0

echo.

echo %name%, your turn.

echo %country%: %user% DEF

echo Options:

echo %enemy%: %cpu% DEF

echo 1. Fire NUKE x %nuke%

echo.

echo 2. Fire Airstrike x %airstrike%

echo.

echo 3. Fire Missiles x %missiles%

echo.

echo 4. Surrender

echo.

echo 5. Do nothing

echo.

set /p move=Select your option:

if '%move%'=='1' goto nuke

if '%move%'=='2' goto airstrike

if '%move%'=='3' goto missiles

if '%move%'=='4' goto surrender

if '%move%'=='5' goto cpu1

goto gameplay

:nuke

cls

if '%nuke%'=='0' goto nonuke

echo.

echo %name% has fired a NUKE headed towards %enemy%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %enemy% has lost 400 DEF!

echo.

pause

set /a cpu=%cpu% - 400

set nuke=0

if '%cpu%'=='0' goto win

if '%cpu%'=='-100' goto win

if '%cpu%'=='-200' goto win

if '%cpu%'=='-300' goto win

goto cpu1

:nonuke

echo.

echo You can't use a nuke since you don't have any more left!

echo.

pause

goto gameplay

:airstrike

cls

if '%airstrike%'=='0' goto noairstrike

echo.

echo %name% has fired an airstrike on %enemy%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %enemy% has lost 300 DEF!

echo.

pause

set /a cpu=%cpu% - 300

set /a airstrike=%airstrike% - 1

if '%cpu%'=='0' goto win

if '%cpu%'=='-100' goto win

if '%cpu%'=='-200' goto win

if '%cpu%'=='-300' goto win

goto cpu1

:noairstrike

echo.

echo You can't use an airstrike since you don't have any more left!

echo.

pause

goto gameplay

:missiles

cls

if '%missiles%'=='0' goto nomissiles

echo.

echo %name% has fired multiple missiles headed towards %enemy%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %enemy% has lost 200 DEF!

echo.

pause

set /a cpu=%cpu% - 200

set /a missiles=%missiles% - 1

if '%cpu%'=='0' goto win

if '%cpu%'=='-100' goto win

if '%cpu%'=='-200' goto win

if '%cpu%'=='-300' goto win

goto cpu1

:nomissiles

echo.

echo You can't use missiles since you don't have any more left!

echo.

pause

goto gameplay

:surrender

color 0c

cls

echo.

echo "We may have lost the war, but we still have our dignity..."

echo.

pause

:end

cls

echo.

echo "We may have lost the war, but we still have our dignity..."

echo.

set /p replay=Type anything to replay the game. Type 'x' to exit:

if '%replay%'=='x' goto suggest

if '%replay%'=='' goto end

goto players

:win

color 02

cls

echo.

echo You have won Total War!!!

echo.

pause

:win2

cls

echo.

echo You have won Total War!!!

echo.

set /p replay=Type anything to replay the game. Type 'x' to exit:

if '%replay%'=='x' goto suggest

if '%replay%'=='' goto win2

goto players

:cpu1

cls

set /a cpucount=%cpucount% + 1

if '%cpucount%'=='10' goto cpu2

echo.

echo My turn.

echo %country%: %user% DEF

echo Options:

echo %enemy%: %cpu% DEF

echo 1. Fire NUKE x %cpunuke%

echo.

echo 2. Fire Airstrike x %cpuairstrike%

echo.

echo 3. Fire Missiles x %cpumissiles%

echo.

echo 4. Surrender

echo.

echo 5. Do nothing

echo.

echo Select your option:/

ping localhost -n 1 >nul

ping localhost -n 1 >nul

ping localhost -n 1 >nul

ping localhost -n 1 >nul

cls

echo.

echo My turn.

echo %country%: %user% DEF

echo Options:

echo %enemy%: %cpu% DEF

echo 1. Fire NUKE x %cpunuke%

echo.

echo 2. Fire Airstrike x %cpuairstrike%

echo.

echo 3. Fire Missiles x %cpumissiles%

echo.

echo 4. Surrender

echo.

echo 5. Do nothing

echo.

echo Select your option:-

ping localhost -n 1 >nul

ping localhost -n 1 >nul

ping localhost -n 1 >nul

ping localhost -n 1 >nul

cls

echo.

echo My turn.

echo %country%: %user% DEF

echo Options:

echo %enemy%: %cpu% DEF

echo 1. Fire NUKE x %cpunuke%

echo.

echo 2. Fire Airstrike x %cpuairstrike%

echo.

echo 3. Fire Missiles x %cpumissiles%

echo.

echo 4. Surrender

echo.

echo 5. Do nothing

echo.

echo Select your option:\

ping localhost -n 1 >nul

ping localhost -n 1 >nul

ping localhost -n 1 >nul

ping localhost -n 1 >nul

goto cpu1

:cpu2

cls

set /a choice=%random% %%6

if '%choice%'=='0' goto cpu2

if '%choice%'=='4' goto cpu2

if '%choice%'=='6' goto cpu2

echo.

echo My turn.

echo %country%: %user% DEF

echo Options:

echo %enemy%: %cpu% DEF

echo 1. Fire NUKE x %cpunuke%

echo.

echo 2. Fire Airstrike x %cpuairstrike%

echo.

echo 3. Fire Missiles x %cpumissiles%

echo.

echo 4. Surrender

echo.

echo 5. Do nothing

echo.

echo Select your option:%choice%

ping localhost -n 4 >nul

if '%choice%'=='1' goto cpunuke

if '%choice%'=='2' goto cpuairstrike

if '%choice%'=='3' goto cpumissiles

if '%choice%'=='5' goto gameplay

:cpunuke

cls

if '%cpunuke%'=='0' goto nocpunuke

echo.

echo I have fired a NUKE headed towards %country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %country% has lost 400 DEF!

echo.

ping localhost -n 4 >nul

set /a user=%user% - 400

set cpunuke=0

if '%user%'=='0' goto cpuwin

if '%user%'=='-100' goto cpuwin

if '%user%'=='-200' goto cpuwin

if '%user%'=='-300' goto cpuwin

goto gameplay

:nocpunuke

echo.

echo I can't use a nuke since I don't have any more left!

echo.

ping localhost -n 4 >nul

set cpucount=0

goto cpu1

:cpuairstrike

cls

if '%cpuairstrike%'=='0' goto nocpuairstrike

echo.

echo I have fired an airstrike on %country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %country% has lost 300 DEF!

echo.

ping localhost -n 4 >nul

set /a user=%user% - 300

set /a cpuairstrike=%cpuairstrike% - 1

if '%user%'=='0' goto cpuwin

if '%user%'=='-100' goto cpuwin

if '%user%'=='-200' goto cpuwin

if '%user%'=='-300' goto cpuwin

goto gameplay

:nocpuairstrike

echo.

echo I can't use an airstrike since I don't have any more left!

echo.

ping localhost -n 4 >nul

set cpucount=0

goto cpu1

:cpumissiles

cls

if '%cpumissiles%'=='0' goto nocpumissiles

echo.

echo I have fired multiple missiles headed towards %country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %country% has lost 200 DEF!

echo.

ping localhost -n 4 >nul

set /a user=%user% - 200

set /a cpumissiles=%cpumissiles% - 1

if '%user%'=='0' goto cpuwin

if '%user%'=='-100' goto cpuwin

if '%user%'=='-200' goto cpuwin

if '%user%'=='-300' goto cpuwin

goto gameplay

:nocpumissiles

echo.

echo I can't use missiles since I don't have any more left!

echo.

ping localhost -n 4 >nul

set cpucount=0

goto cpu1

:cpuwin

color 0c

cls

echo.

echo It was a long battle today. I have emerged victorious, even though you tried

echo very well.

echo.

pause

:cpuwin2

cls

echo.

echo It was a long battle today. I have emerged victorious, even though you tried

echo very well.

echo.

set /p replay=Type anything to replay the game. Type 'x' to exit:

if '%replay%'=='x' goto suggest

if '%replay%'=='' goto cpuwin2

goto players

:p1name

cls

set p1name=

echo.

set /p p1name=Player 1, please type in your name (One word):

if '%p1name%'=='' goto p1name

:p2name

cls

set p2name=

echo.

set /p p2name=Player 2, please type in your name (One word):

if '%p2name%'=='%p1name%' goto p2name

if '%p2name%'=='' goto p2name

rem Easter Egg:

if '%p1name%'=='Vincent' goto p1win

if '%p2name%'=='Vincent' goto p2win

:p1country

cls

set p1country=

echo.

echo Welcome %p1name%!

echo.

set /p p1country=Choose your country; USA, Russia, or Canada:

if '%p1country%'=='usa' goto p1country1

if '%p1country%'=='USA' goto p1country1

if '%p1country%'=='Usa' goto p1country1

if '%p1country%'=='Russia' goto p1country2

if '%p1country%'=='russia' goto p1country2

if '%p1country%'=='canada' goto p1country3

if '%p1country%'=='Canada' goto p1country3

if '%p1country%'=='UK' got p1country4

if '%p1country%'=='uk' got p1country4

if '%p1country%'=='Uk' got p1country4

goto p1country

:p1country1

set p1country=USA

goto p2country

:p1country2

set p1country=Russia

goto p2country

:p1country3

set p1country=Canada

:p1country4

set p1country=UK

:p2country

cls

set p2country=

echo.

echo Welcome %p2name%!

echo.

set /p p2country=Choose your country; USA, Russia, UK, or Canada:

if '%p2country%'=='%p1country%' goto na

if '%p2country%'=='usa' goto p2country1

if '%p2country%'=='USA' goto p2country1

if '%p2country%'=='Usa' goto p2country1

if '%p2country%'=='Russia' goto p2country2

if '%p2country%'=='russia' goto p2country2

if '%p2country%'=='canada' goto p2country3

if '%p2country%'=='Canada' goto p2country3

if '%p2country%'=='UK' got p2country4

if '%p2country%'=='uk' got p2country4

if '%p2country%'=='Uk' got p2country4

goto p2country

:na

cls

echo.

echo You can't choose %p1country% because %p1name% has already chosen it.

pause >nul

goto p2country

:p2country1

set p2country=USA

goto begin2

:p2country2

set p2country=Russia

goto begin2

:p2country3

set p2country=Canada

goto begin2

:p2country4

set p2country=UK

goto begin2

:begin2

set p1health=1000

set p2health=1000

set p1nuke=1

set p1airstrike=2

set p1missiles=3

set p2nuke=1

set p2airstrike=2

set p2missiles=3

:p1gameplay

cls

set move=

set choice=

echo.

echo %p1name%, your turn.

echo %p1country%: %p1health% DEF

echo Options:

echo %p2country%: %p2health% DEF

echo 1. Fire NUKE x %p1nuke%

echo.

echo 2. Fire Airstrike x %p1airstrike%

echo.

echo 3. Fire Missiles x %p1missiles%

echo.

echo 4. Surrender

echo.

echo 5. Do nothing

echo.

set /p move=Select your option:

if '%move%'=='1' goto p1nuke

if '%move%'=='2' goto p1airstrike

if '%move%'=='3' goto p1missiles

if '%move%'=='4' goto p1surrender

if '%move%'=='5' goto p2gameplay

goto p1gameplay

:p1nuke

cls

if '%p1nuke%'=='0' goto nop1nuke

echo.

echo %p1name% has fired a NUKE headed towards %p2country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %p2country% has lost 400 DEF!

echo.

pause

set /a p2health=%p2health% - 400

set p1nuke=0

if '%p2health%'=='0' goto p1win

if '%p2health%'=='-100' goto p1win

if '%p2health%'=='-200' goto p1win

if '%p2health%'=='-300' goto p1win

goto p2gameplay

:nop1nuke

echo.

echo You can't use a nuke since you don't have any more left!

echo.

pause

goto p1gameplay

:p1airstrike

cls

if '%p1airstrike%'=='0' goto nop1airstrike

echo.

echo %p1name% has fired an airstrike on %p2country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %p2country% has lost 300 DEF!

echo.

pause

set /a p2health=%p2health% - 300

set /a p1airstrike=%p1airstrike% - 1

if '%p2health%'=='0' goto p1win

if '%p2health%'=='-100' goto p1win

if '%p2health%'=='-200' goto p1win

if '%p2health%'=='-300' goto p1win

goto p2gameplay

:nop1airstrike

echo.

echo You can't use an airstrike since you don't have any more left!

echo.

pause

goto p1gameplay

:p1missiles

cls

if '%p1missiles%'=='0' goto nop1missiles

echo.

echo %p1name% has fired multiple missiles headed towards %p2country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %p2country% has lost 200 DEF!

echo.

pause

set /a p2health=%p2health% - 200

set /a p1missiles=%p1missiles% - 1

if '%p2health%'=='0' goto p1win

if '%p2health%'=='-100' goto p1win

if '%p2health%'=='-200' goto p1win

if '%p2health%'=='-300' goto p1win

goto p2gameplay

:nop1missiles

echo.

echo You can't use missiles since you don't have any more left!

echo.

pause

goto p1gameplay

:p1surrender

color 02

cls

echo.

echo %p2name% has won Total War!!!

echo.

pause

:p1surrender2

cls

echo.

echo %p2name% has won Total War!!!

echo.

set /p replay=Type anything to replay the game. Type 'x' to exit:

if '%replay%'=='x' goto suggest

if '%replay%'=='' goto p1surrender2

goto players

:p1win

color 02

cls

echo.

echo %p1name% has won Total War!!!

echo.

pause

:p1win2

cls

echo.

echo %p1name% has won Total War!!!

echo.

set /p replay=Type anything to replay the game. Type 'x' to exit:

if '%replay%'=='x' goto suggest

if '%replay%'=='' goto p1win2

goto players

:p2gameplay

cls

set move=

set choice=

echo.

echo %p2name%, your turn.

echo %p2country%: %p2health% DEF

echo Options:

echo %p1country%: %p1health% DEF

echo 1. Fire NUKE x %p2nuke%

echo.

echo 2. Fire Airstrike x %p2airstrike%

echo.

echo 3. Fire Missiles x %p2missiles%

echo.

echo 4. Surrender

echo.

echo 5. Do nothing

echo.

set /p move=Select your option:

if '%move%'=='1' goto p2nuke

if '%move%'=='2' goto p2airstrike

if '%move%'=='3' goto p2missiles

if '%move%'=='4' goto p2surrender

if '%move%'=='5' goto p1gameplay

goto p2gameplay

:p2nuke

cls

if '%p2nuke%'=='0' goto nop2nuke

echo.

echo %p2name% has fired a NUKE headed towards %p1country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %p1country% has lost 400 DEF!

echo.

pause

set /a p1health=%p1health% - 400

set p2nuke=0

if '%p1health%'=='0' goto p2win

if '%p1health%'=='-100' goto p2win

if '%p1health%'=='-200' goto p2win

if '%p1health%'=='-300' goto p2win

goto p1gameplay

:nop2nuke

echo.

echo You can't use a nuke since you don't have any more left!

echo.

pause

goto p2gameplay

:p2airstrike

cls

if '%p2airstrike%'=='0' goto nop2airstrike

echo.

echo %p2name% has fired an airstrike on %p1country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %p1country% has lost 300 DEF!

echo.

pause

set /a p1health=%p1health% - 300

set /a p2airstrike=%p2airstrike% - 1

if '%p1health%'=='0' goto p2win

if '%p1health%'=='-100' goto p2win

if '%p1health%'=='-200' goto p2win

if '%p1health%'=='-300' goto p2win

goto p1gameplay

:nop2airstrike

echo.

echo You can't use an airstrike since you don't have any more left!

echo.

pause

goto p2gameplay

:p2missiles

cls

if '%p2missiles%'=='0' goto nop2missiles

echo.

echo %p2name% has fired multiple missiles headed towards %p1country%!

echo.

ping localhost -n 4 >nul

echo Hit!

echo.

echo %p1country% has lost 200 DEF!

echo.

pause

set /a p1health=%p1health% - 200

set /a p2missiles=%p2missiles% - 1

if '%p1health%'=='0' goto p2win

if '%p1health%'=='-100' goto p2win

if '%p1health%'=='-200' goto p2win

if '%p1health%'=='-300' goto p2win

goto p1gameplay

:nop2missiles

echo.

echo You can't use missiles since you don't have any more left!

echo.

pause

goto p2gameplay

:p2surrender

color 02

cls

echo.

echo %p1name% has won Total War!!!

echo.

pause

:p2surrender2

cls

echo.

echo %p1name% has won Total War!!!

echo.

set /p replay=Type anything to replay the game. Type 'x' to exit:

if '%replay%'=='x' goto suggest

if '%replay%'=='' goto p2surrender2

goto players

color 02

:p2win

cls

echo.

echo %p2name% has won Total War!!!

echo.

pause

:p2win2

cls

echo.

echo %p2name% has won Total War!!!

echo.

set /p replay=Type anything to replay the game. Type 'x' to exit:

if '%replay%'=='x' goto suggest

if '%replay%'=='' goto p2win2

goto players

:suggest

cls

echo.

echo Before you leave, can you suggest a country I can add to the file?

echo.

set /p suggestion=Suggest a country here:

if '%suggestion%'=='' goto suggest

echo %suggestion% >> suggestions.txt

So, this, as mentioned in the script, is a 1.2 version of the game, slightly improved to change colors when you win or lose, and have an extra country added in: The UK. Also, I hope you don't mind, but I noticed your Easter egg, and I added myself into it. Hope you enjoy this updated version!

game.PNG
author
karlis.cernavskis (author)2015-01-30

But i fixed it myself.

author
karlis.cernavskis (author)2015-01-30

It has a problem. When i launch it i see: D:\Users\(User)\Desktop>echo off

author
Krishna Chaudhari (author)2014-10-27

you should use color 0a it would like nice

author
cool-guy (author)2014-07-08

Well, at least it works. However, the script is way too long and everything could be a lot easier.

A simple example:

"IF "%country%" == "USA" GOTO :enemy2

IF "%country%" == "Usa" GOTO :enemy2

IF "%country%" == "usa" GOTO :enemy2."

This can be lots easier with just writing the following:

"IF /I "%country%" == "USA" GOTO :enemy2"

author
spideypark (author)2014-05-30

Awesome!!!

author
CallumBatchDevelopment (author)2014-02-22

Remarkable !

Very well done!

Creativity at its finest :) Keep it up!

author
cool-guy (author)2013-12-19

Nice game, but on my computer it doens't work how it must work.
You writed: if '%name%' == '' goto name
On my computer the program just closes.

author
Mishter H (author)2013-11-16

my cousin said he made this batch file, that means he is a liar

author

i have some idea of what that will do. how did you manage to work it all out?

About This Instructable

45,863views

23favorites

License:

More by BATCHFILEMASTER:War Based Game in Batch File
Add instructable to: