<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1386561136029030105</id><updated>2011-11-27T19:28:34.807-06:00</updated><category term='macro'/><category term='math'/><category term='chat room'/><category term='alarm clock'/><category term='Vbscript'/><category term='batch'/><title type='text'>Scripting Madness</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://scriptingmadness.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1386561136029030105/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://scriptingmadness.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>r0ck3t3r</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1386561136029030105.post-1890819430052336545</id><published>2009-05-31T14:54:00.007-05:00</published><updated>2009-06-01T23:48:57.005-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='batch'/><category scheme='http://www.blogger.com/atom/ns#' term='math'/><title type='text'>Batch File Basic Math Trainer: Math in Batch Files</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_AiEN4RJa-v4/SiSu9BVjCMI/AAAAAAAAAQk/S-I2wrxe0QY/s1600-h/math.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 158px;" src="http://2.bp.blogspot.com/_AiEN4RJa-v4/SiSu9BVjCMI/AAAAAAAAAQk/S-I2wrxe0QY/s320/math.bmp" alt="" id="BLOGGER_PHOTO_ID_5342587421322315970" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Is it possible to write a math game in Batch? Yes. But it is not as easy to work with as in true programming languages. The code in this game should help anyone who wants to learn more about working with numbers in a batch file.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;@echo&lt;/span&gt; off&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;title &lt;/span&gt;Batch Basic Math Quiz&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;color&lt;/span&gt; 1f&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;:title&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;CLS&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo             &lt;/span&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;Welcome&lt;/span&gt; to Batch Basic Math Quiz&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo         &lt;/span&gt;http://ScriptingMadness.blogspot.com&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo. &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo                              &lt;/span&gt;+  -  *  /&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo &lt;/span&gt;     Pick a number:&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt;   1  for  Addition&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt;   2  for  Subtraction&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo &lt;/span&gt;  3  for  Multiplication&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo &lt;/span&gt;  4  for  Division&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo &lt;/span&gt;  5  for  All the Above&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt;   6  to   Exit&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /p&lt;/span&gt; topic=  :&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;goto&lt;/span&gt;&lt;/span&gt; begin&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;REM ###### MULTI ##############&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;:multi&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /a&lt;/span&gt; int1=&lt;span style="color: rgb(204, 51, 204);"&gt;%random%&lt;/span&gt;%%100+1&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /a&lt;/span&gt; int2=&lt;span style="color: rgb(204, 51, 204);"&gt;%random%&lt;/span&gt;%%100+1&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt; question=&lt;span style="color: rgb(204, 51, 204);"&gt;%int1%&lt;/span&gt;*&lt;span style="color: rgb(204, 51, 204);"&gt;%int2%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt; /a answer=&lt;span style="color: rgb(204, 51, 204);"&gt;%question%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /p&lt;/span&gt; guess=&lt;span style="color: rgb(204, 51, 204);"&gt;%int1%&lt;/span&gt; x &lt;span style="color: rgb(204, 51, 204);"&gt;%int2%&lt;/span&gt; =&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;RightWrong&lt;/span&gt;=Wrong&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%guess%&lt;/span&gt;==EXIT &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;goto&lt;/span&gt;&lt;/span&gt; title&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%guess%&lt;/span&gt;==Exit &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;goto&lt;/span&gt;&lt;/span&gt; title&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%guess%&lt;/span&gt;==exit &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;goto&lt;/span&gt;&lt;/span&gt; title&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%guess%&lt;/span&gt;==&lt;span style="color: rgb(204, 51, 204);"&gt;%answer%&lt;/span&gt; set &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;RightWrong&lt;/span&gt;=Correct&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;rem Score&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;set &lt;/span&gt;return=&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;MultiScore&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;goto&lt;/span&gt;&lt;/span&gt; Score&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;:&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;MultiScore&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0);"&gt;rem ----&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;%answer%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; You are &lt;span style="color: rgb(204, 51, 204);"&gt;%&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;RightWrong&lt;/span&gt;%&lt;/span&gt;.                         Points:&lt;span style="color: rgb(204, 51, 204);"&gt; %score%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo &lt;/span&gt;--------------------------------------------------------------&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;goto&lt;/span&gt;&lt;/span&gt; next&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM ###### Add #########&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;:add&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /a&lt;/span&gt; int1=&lt;span style="color: rgb(204, 51, 204);"&gt;%random%&lt;/span&gt;%%100+1&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /a&lt;/span&gt; int2=&lt;span style="color: rgb(204, 51, 204);"&gt;%random%&lt;/span&gt;%%100+1&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt; question=&lt;span style="color: rgb(204, 51, 204);"&gt;%int1%&lt;/span&gt;+&lt;span style="color: rgb(204, 51, 204);"&gt;%int2%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /a&lt;/span&gt; answer=&lt;span style="color: rgb(204, 51, 204);"&gt;%question%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo. &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /p&lt;/span&gt; guess=&lt;span style="color: rgb(204, 51, 204);"&gt;%int1%&lt;/span&gt; + &lt;span style="color: rgb(204, 51, 204);"&gt;%int2%&lt;/span&gt; =&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;RightWrong&lt;/span&gt;=Wrong&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%guess%&lt;/span&gt;==EXIT &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;goto&lt;/span&gt;&lt;/span&gt; title&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%guess%&lt;/span&gt;==Exit&lt;span style="color: rgb(0, 0, 153);"&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;goto&lt;/span&gt;&lt;/span&gt; title&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%guess%&lt;/span&gt;==exit &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;goto&lt;/span&gt;&lt;/span&gt; title&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%guess%&lt;/span&gt;==&lt;span style="color: rgb(204, 51, 204);"&gt;%answer%&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;RightWrong&lt;/span&gt;=Correct&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;rem Score&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt; return=&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;AddScore&lt;/span&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;goto&lt;/span&gt; Score&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;:&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20"&gt;AddScore&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;rem ----&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; =&lt;span style="color: rgb(204, 51, 204);"&gt; %answer%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo &lt;/span&gt;You are &lt;span style="color: rgb(204, 51, 204);"&gt;%&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21"&gt;RightWrong&lt;/span&gt;%. &lt;/span&gt;                        Points: &lt;span style="color: rgb(204, 51, 204);"&gt;%score%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; --------------------------------------------------------------&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22"&gt;goto&lt;/span&gt;&lt;/span&gt; next&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM ###### Sub ##############&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;:sub&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /a&lt;/span&gt; int1=&lt;span style="color: rgb(204, 51, 204);"&gt;%random%&lt;/span&gt;%%100+1&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /a&lt;/span&gt; int2=&lt;span style="color: rgb(204, 51, 204);"&gt;%random%&lt;/span&gt;%%100+1&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt; question=&lt;span style="color: rgb(204, 51, 204);"&gt;%int1%&lt;/span&gt;-&lt;span style="color: rgb(204, 51, 204);"&gt;%int2%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /a&lt;/span&gt; answer=%question%&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo. &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /p&lt;/span&gt; guess=&lt;span style="color: rgb(204, 51, 204);"&gt;%int1%&lt;/span&gt; - &lt;span style="color: rgb(204, 51, 204);"&gt;%int2%&lt;/span&gt; =&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set &lt;/span&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23"&gt;RightWrong&lt;/span&gt;=Wrong&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%guess%&lt;/span&gt;==EXIT &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_24"&gt;goto&lt;/span&gt; &lt;/span&gt;title&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if &lt;/span&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;%guess%&lt;/span&gt;==Exit &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_25"&gt;goto&lt;/span&gt; &lt;/span&gt;title&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%guess%&lt;/span&gt;==exit &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_26"&gt;goto&lt;/span&gt; &lt;/span&gt;title&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if &lt;/span&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;%guess%&lt;/span&gt;==&lt;span style="color: rgb(204, 51, 204);"&gt;%answer%&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;set &lt;/span&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_27"&gt;RightWrong&lt;/span&gt;=Correct&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;rem Score&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set &lt;/span&gt;return=&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_28"&gt;SubScore&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_29"&gt;goto&lt;/span&gt;&lt;/span&gt; Score&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;:&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_30"&gt;SubScore&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;rem ----&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;%answer%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; You are &lt;span style="color: rgb(204, 51, 204);"&gt;%&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_31"&gt;RightWrong&lt;/span&gt;%&lt;/span&gt;.                         Points: &lt;span style="color: rgb(204, 51, 204);"&gt;%score%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; --------------------------------------------------------------&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_32"&gt;goto&lt;/span&gt;&lt;/span&gt; next&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM ###### Div ##############&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;:div&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /a&lt;/span&gt; int1=&lt;span style="color: rgb(204, 51, 204);"&gt;%random%&lt;/span&gt;%%100+1&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /a&lt;/span&gt; int2=&lt;span style="color: rgb(204, 51, 204);"&gt;%random%&lt;/span&gt;%%20+1&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set &lt;/span&gt;question=&lt;span style="color: rgb(204, 51, 204);"&gt;%int1%&lt;/span&gt;/&lt;span style="color: rgb(204, 51, 204);"&gt;%int2%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /a&lt;/span&gt; answer=&lt;span style="color: rgb(204, 51, 204);"&gt;%question%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /a&lt;/span&gt; remainder="(&lt;span style="color: rgb(204, 51, 204);"&gt;%int1%&lt;/span&gt;) %% (&lt;span style="color: rgb(204, 51, 204);"&gt;%int2%&lt;/span&gt;)"&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%remainder%&lt;/span&gt;==0 &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_33"&gt;goto&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_34"&gt;SkipRemainder&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt; answer=&lt;span style="color: rgb(204, 51, 204);"&gt;%answer%&lt;/span&gt;_&lt;span style="color: rgb(204, 51, 204);"&gt;%remainder%&lt;/span&gt;&lt;br /&gt;:&lt;span style="font-weight: bold;"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_35"&gt;SkipRemainder&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo &lt;/span&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_36"&gt;Seperate&lt;/span&gt; Answer and Remainder with an Underscore "_".&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt;.&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /p&lt;/span&gt; guess=&lt;span style="color: rgb(204, 51, 204);"&gt;%int1%&lt;/span&gt; / &lt;span style="color: rgb(204, 51, 204);"&gt;%int2%&lt;/span&gt; =&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set &lt;/span&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_37"&gt;RightWrong&lt;/span&gt;=Wrong&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%guess%&lt;/span&gt;==EXIT &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_38"&gt;goto&lt;/span&gt; &lt;/span&gt;title&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%guess%&lt;/span&gt;==Exit &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_39"&gt;goto&lt;/span&gt; &lt;/span&gt;title&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%guess%&lt;/span&gt;==exit &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_40"&gt;goto&lt;/span&gt; &lt;/span&gt;title&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%guess%&lt;/span&gt;==&lt;span style="color: rgb(204, 51, 204);"&gt;%answer%&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;set &lt;/span&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_41"&gt;RightWrong&lt;/span&gt;=Correct&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;rem Score&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt; return=&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_42"&gt;divScore&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_43"&gt;goto&lt;/span&gt; &lt;/span&gt;Score&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;:&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_44"&gt;divScore&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;rem ----&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; = &lt;span style="color: rgb(204, 51, 204);"&gt;%answer%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo &lt;/span&gt;You are &lt;span style="color: rgb(204, 51, 204);"&gt;%&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_45"&gt;RightWrong&lt;/span&gt;%&lt;/span&gt;.                         Points: &lt;span style="color: rgb(204, 51, 204);"&gt;%score%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; --------------------------------------------------------------&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_46"&gt;goto&lt;/span&gt; &lt;/span&gt;next&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;:begin&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set &lt;/span&gt;score=0&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; --------------------------------------------------------------&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt;             TO RETURN TO MAIN MENU, TYPE EXIT&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; Reach a score of 20 to Pass. Try not to use a calculator!&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; #For a great flash cards maker, try flash-card-it.blogspot.com&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; --------------------------------------------------------------&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;:next&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set &lt;/span&gt;all="false"&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%topic%&lt;/span&gt;==1 &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_47"&gt;goto&lt;/span&gt; add&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if &lt;/span&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;%topic%&lt;/span&gt;==2 &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_48"&gt;goto&lt;/span&gt; sub&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%topic%&lt;/span&gt;==3 &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_49"&gt;goto&lt;/span&gt; multi&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%topic%&lt;/span&gt;==4 &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_50"&gt;goto&lt;/span&gt; div&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(204, 51, 204);"&gt; %topic%&lt;/span&gt;==5 &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_51"&gt;goto&lt;/span&gt; all&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%topic%&lt;/span&gt;==6 exit&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_52"&gt;goto&lt;/span&gt; &lt;/span&gt;title&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;:Score&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_53"&gt;RightWrong&lt;/span&gt;%&lt;/span&gt;==Wrong set &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_54"&gt;ScoreMath&lt;/span&gt;=&lt;span style="color: rgb(204, 51, 204);"&gt;%score%&lt;/span&gt;-1&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_55"&gt;RightWrong&lt;/span&gt;%&lt;/span&gt;==Correct set &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_56"&gt;ScoreMath&lt;/span&gt;=&lt;span style="color: rgb(204, 51, 204);"&gt;%score%&lt;/span&gt;+1&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt; &lt;span style="color: rgb(51, 51, 255);"&gt;/a score&lt;/span&gt;=&lt;span style="color: rgb(204, 51, 204);"&gt;%&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_57"&gt;ScoreMath&lt;/span&gt;%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%score%&lt;/span&gt;==20 &lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_58"&gt;goto&lt;/span&gt;&lt;/span&gt; win&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_59"&gt;goto&lt;/span&gt;&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%return%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;:win&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_60"&gt;CLS&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; ------------------------------------------&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; -                                        -&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; -     CONGRATULATIONS!!! YOU PASSED!     -&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; -                                        -&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; ------------------------------------------&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; Score: 20&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;pause&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_61"&gt;cls&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;goto&lt;/span&gt; title&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;:all&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /a&lt;/span&gt; pick=&lt;span style="color: rgb(204, 51, 204);"&gt;%random%&lt;/span&gt;%%4+1&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(204, 51, 204);"&gt; %pick%&lt;/span&gt;==1 &lt;span style="color: rgb(51, 51, 255);"&gt;goto&lt;/span&gt; add&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%pick%&lt;/span&gt;==2 &lt;span style="color: rgb(51, 51, 255);"&gt;goto&lt;/span&gt; sub&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%pick%&lt;/span&gt;==3&lt;span style="color: rgb(51, 51, 255);"&gt; goto&lt;/span&gt; multi&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%pick%&lt;/span&gt;==4 &lt;span style="color: rgb(51, 51, 255);"&gt;goto&lt;/span&gt; div&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;goto &lt;/span&gt;error&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;REM #####################################&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;:error&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt; The program has encountered an error!&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo &lt;/span&gt;It will now close&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt;.&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;echo&lt;/span&gt;.&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;exit&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The code is a bit disorganized, but it should still be fairly readable. The interesting command for working with numbers in a batch file is the &lt;span style="color: rgb(51, 51, 255);"&gt;set /a&lt;/span&gt; command. I had some trouble getting the command to work properly if I  tried to use a varible and an operator like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /a&lt;/span&gt; answer=&lt;span style="color: rgb(204, 51, 204);"&gt;%var1%&lt;/span&gt;+&lt;span style="color: rgb(204, 51, 204);"&gt;%var2%&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;It seems to only work if working with a single variable that already contains the problem like so.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set&lt;/span&gt; question=&lt;span style="color: rgb(204, 51, 204);"&gt;%var1%&lt;/span&gt;+&lt;span style="color: rgb(204, 51, 204);"&gt;%var2%&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 51, 255);"&gt;set /a&lt;/span&gt; answer=&lt;span style="color: rgb(204, 51, 204);"&gt;%question%&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The above code works perfectly. Another important thing to remember when working with math in batch files is the modulus operator. It uses the % sign. The problem arises when trying to use the modulus operator on two varibles. It ends up looking like this:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;%var1%&lt;/span&gt; % &lt;span style="color: rgb(204, 51, 204);"&gt;%var2%&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Unfortunately, this code does not work. The batch file ignores the % operator. This can be solved by using two instead of one.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 51, 204);"&gt;%var1%&lt;/span&gt; %% &lt;span style="color: rgb(204, 51, 204);"&gt;%var2%&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Not pretty, but plenty functional.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Wish List:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here are some ideas to further improve the script.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Create levels of difficulty. Right now the problems are all fairly simple.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Create a Accuracy Counter.&lt;/li&gt;&lt;li&gt;Clean up the interface&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1386561136029030105-1890819430052336545?l=scriptingmadness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingmadness.blogspot.com/feeds/1890819430052336545/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1386561136029030105&amp;postID=1890819430052336545' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1386561136029030105/posts/default/1890819430052336545'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1386561136029030105/posts/default/1890819430052336545'/><link rel='alternate' type='text/html' href='http://scriptingmadness.blogspot.com/2009/05/batch-file-basic-math-trainer-math-in.html' title='Batch File Basic Math Trainer: Math in Batch Files'/><author><name>r0ck3t3r</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_AiEN4RJa-v4/SiSu9BVjCMI/AAAAAAAAAQk/S-I2wrxe0QY/s72-c/math.bmp' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1386561136029030105.post-478574096164208500</id><published>2009-05-27T22:02:00.004-05:00</published><updated>2009-06-01T23:45:58.125-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='batch'/><category scheme='http://www.blogger.com/atom/ns#' term='chat room'/><title type='text'>Create a Batch File Chat Room</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_AiEN4RJa-v4/SiSugXRw5gI/AAAAAAAAAQc/jqApmLiDB6M/s1600-h/batchchat.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 158px;" src="http://4.bp.blogspot.com/_AiEN4RJa-v4/SiSugXRw5gI/AAAAAAAAAQc/jqApmLiDB6M/s320/batchchat.bmp" alt="" id="BLOGGER_PHOTO_ID_5342586928995821058" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;It is possible to build a full featured chat room using only the Window's batch programming language. It may not be pretty, but it gets the job done.&lt;br /&gt;&lt;br /&gt;The idea is simple. Everyone writes to the same file.  Collect input from the user and write it to that file. Then read that file to the screen to see what anyone else has said. Here is my code:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;@echo&lt;/span&gt; off&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;rem: Matthew Merchant ScriptingMadness.blogspot.com&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;rem ###### TITLE SCREEN  ############&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;title&lt;/span&gt; Batch Chat Room&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;color&lt;/span&gt; f0&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;echo&lt;/span&gt;              Welcome to Office Chat Room.&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;echo&lt;/span&gt;.    &lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;echo&lt;/span&gt;   Commands:&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;echo&lt;/span&gt;   type CLS to clear the chat log.&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;echo&lt;/span&gt;   type EXIT to quit the chat room.&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;echo &lt;/span&gt;  just hit enter to update screen.&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;set&lt;/span&gt; /p username=What is your name?&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;echo&lt;/span&gt; %username% has joined. &gt;&gt; log.dat&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;cls&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;goto&lt;/span&gt; CHATLOOP&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;REM ############################&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;REM ########## CHAT LOOP ##########&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;set&lt;/span&gt; lastmessage=""&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;:CHATLOOP&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;cls&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;type&lt;/span&gt; log.dat&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;echo.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;set&lt;/span&gt; /p message=Say:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;rem set message checker value&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;set&lt;/span&gt; thismessage="&lt;span style="color: rgb(204, 51, 204);"&gt;%message%&lt;/span&gt;"&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;rem check for exit&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%thismessage%&lt;/span&gt; == "EXIT" echo &lt;span style="color: rgb(204, 51, 204);"&gt;%username%&lt;/span&gt; has left the chat room. &gt;&gt; log.dat&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%thismessage%&lt;/span&gt; == "EXIT" exit&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;rem -----------------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;rem check for clear&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%thismessage%&lt;/span&gt; == "CLS" &lt;span style="color: rgb(51, 102, 255);"&gt;echo&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%username%&lt;/span&gt; has cleared the chat log. &gt; log.dat&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%thismessage%&lt;/span&gt; == "CLS" &lt;span style="color: rgb(51, 102, 255);"&gt;set&lt;/span&gt; message=Empty&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%thismessage%&lt;/span&gt; == "CLS" &lt;span style="color: rgb(51, 102, 255);"&gt;set&lt;/span&gt; lastmessage="Empty"&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%thismessage%&lt;/span&gt; == "CLS" &lt;span style="color: rgb(51, 102, 255);"&gt;goto&lt;/span&gt; CHATLOOP&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;rem ------------------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;rem check for same message as last time&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;if&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%thismessage% &lt;/span&gt;== &lt;span style="color: rgb(204, 51, 204);"&gt;%lastmessage%&lt;/span&gt;&lt;span style="color: rgb(51, 102, 255);"&gt; goto&lt;/span&gt; CHATLOOP&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;rem if all checks out, go ahead and post this message&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;echo&lt;/span&gt; &lt;span style="color: rgb(204, 51, 204);"&gt;%username%&lt;/span&gt;: &lt;span style="color: rgb(204, 51, 204);"&gt;%message%&lt;/span&gt; &gt;&gt; log.dat&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;rem save value for next test&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;set&lt;/span&gt; lastmessage="&lt;span style="color: rgb(204, 51, 204);"&gt;%message%&lt;/span&gt;"&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;goto&lt;/span&gt; CHATLOOP&lt;br /&gt;&lt;span style="color: rgb(51, 255, 51);"&gt;REM ################################&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Pretty basic stuff. The hard part was implementing my two features. The first feature was CLS. This command clears the chat log by writing to it with the &gt; symbol. This is helpful when the chat log gets too big because it slows the program down. The second feature is the EXIT command. This gracefully shuts the batch chat program down after sending a exit message to the other users.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Wish List:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I would have liked this program to update in real time. This would be possible if two batch files were used. One could be used for input, and another could be used for displaying the chat log. I can't figure out a way to do it with one batch file.&lt;br /&gt;&lt;br /&gt;It might also be neat to create an HTA chat room that works in a similar way. This would present the user with a nicer interface, and it could also be updated in real time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1386561136029030105-478574096164208500?l=scriptingmadness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingmadness.blogspot.com/feeds/478574096164208500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1386561136029030105&amp;postID=478574096164208500' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1386561136029030105/posts/default/478574096164208500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1386561136029030105/posts/default/478574096164208500'/><link rel='alternate' type='text/html' href='http://scriptingmadness.blogspot.com/2009/05/create-batch-file-chat-room.html' title='Create a Batch File Chat Room'/><author><name>r0ck3t3r</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_AiEN4RJa-v4/SiSugXRw5gI/AAAAAAAAAQc/jqApmLiDB6M/s72-c/batchchat.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1386561136029030105.post-6681869189863887333</id><published>2009-05-23T19:11:00.002-05:00</published><updated>2009-06-01T23:43:51.212-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Vbscript'/><category scheme='http://www.blogger.com/atom/ns#' term='macro'/><title type='text'>Creating Keyboard Macros in VBScript</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_AiEN4RJa-v4/SiSt-XVFioI/AAAAAAAAAQU/ZRE9H36IMF4/s1600-h/macro.bmp"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 196px;" src="http://1.bp.blogspot.com/_AiEN4RJa-v4/SiSt-XVFioI/AAAAAAAAAQU/ZRE9H36IMF4/s320/macro.bmp" alt="" id="BLOGGER_PHOTO_ID_5342586344894204546" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Creating a keyboard macro in VBScript is an easy and highly portable way to automate tasks for any Windows machine. It is portable because every modern installation of Windows will have the Windows Scripting Host (WSH) installed, and  that is all that is required to run the VBScript source code.&lt;br /&gt;&lt;br /&gt;But I have found that writing a macro in VBScript can be time consuming. Truthfully, when starting from scratch it is much easier to use a language dedicated to macro building such as &lt;a href="http://www.autoitscript.com/autoit3/index.shtml"&gt;Autoit&lt;/a&gt;. However, by using a &lt;a href="http://vbscript-macro-template.blogspot.com/"&gt;VBScript macro template&lt;/a&gt; you can easily create macros that are much more human readable, even to a complete computer novice. Use the link above to download one that I have created.&lt;br /&gt;&lt;br /&gt;By using the template, I have been able to teach a few of the users at my work how to automate some of the tasks they were performing manually everyday. I have even found that I prefer my template's language over the commands available to Autoit. But I do realize it is rather limited.&lt;br /&gt;&lt;br /&gt;Again, here is the link to the &lt;a href="http://vbscript-macro-template.blogspot.com/"&gt;VBScript keyboard macro template&lt;/a&gt; that I have created.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1386561136029030105-6681869189863887333?l=scriptingmadness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingmadness.blogspot.com/feeds/6681869189863887333/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1386561136029030105&amp;postID=6681869189863887333' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1386561136029030105/posts/default/6681869189863887333'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1386561136029030105/posts/default/6681869189863887333'/><link rel='alternate' type='text/html' href='http://scriptingmadness.blogspot.com/2009/05/creating-keyboard-macros-in-vbscript.html' title='Creating Keyboard Macros in VBScript'/><author><name>r0ck3t3r</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_AiEN4RJa-v4/SiSt-XVFioI/AAAAAAAAAQU/ZRE9H36IMF4/s72-c/macro.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1386561136029030105.post-7800840986607368486</id><published>2009-05-22T12:49:00.000-05:00</published><updated>2009-05-28T22:01:34.240-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='batch'/><category scheme='http://www.blogger.com/atom/ns#' term='alarm clock'/><title type='text'>How to Program a Batch File Alarm Clock</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_AiEN4RJa-v4/ShbrJxj8pYI/AAAAAAAAAPA/3feQEMFKSQo/s1600-h/BatchAlarm.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 158px;" src="http://4.bp.blogspot.com/_AiEN4RJa-v4/ShbrJxj8pYI/AAAAAAAAAPA/3feQEMFKSQo/s320/BatchAlarm.JPG" alt="" id="BLOGGER_PHOTO_ID_5338712961449764226" border="0" /&gt;&lt;/a&gt;I had lost my cell phone, and it was lunch time. I wanted to take a short nap, but I had no way wake myself up. It is a sad fact that when Windows XP was developed, they forgot to include a built in alarm clock. Here is a batch file solution to that problem that I whipped up.&lt;br /&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;CLS&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;@&lt;/span&gt;&lt;span style="color: rgb(0, 0, 153);font-size:85%;" &gt;echo&lt;/span&gt;&lt;span style="font-size:85%;"&gt; off&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;color&lt;/span&gt;&lt;span style="font-size:85%;"&gt; f0&lt;br /&gt;title Batch Alarm Clock&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;echo.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;echo.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;echo.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;echo&lt;/span&gt;&lt;span style="font-size:85%;"&gt; Use the 24 hour clock: example 15:00 for 3:00PM&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;echo.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;set&lt;/span&gt;&lt;span style="font-size:85%;"&gt; /p a=Set Alarm:&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;CLS&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;echo.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;echo.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;echo&lt;/span&gt;&lt;span style="font-size:85%;"&gt; Alarm is set for &lt;/span&gt;&lt;span style="color: rgb(204, 51, 204);font-size:85%;" &gt;%a%&lt;/span&gt;&lt;span style="font-size:85%;"&gt;.&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;echo.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;echo&lt;/span&gt;&lt;span style="font-size:85%;"&gt; You may minimize this window.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);font-size:85%;" &gt;REM #### ALARM LOGIC ####&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 255, 51);font-size:85%;" &gt;REM alarm will only sound for one minute.&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;:top&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;if&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;span style="color: rgb(204, 51, 204);font-size:85%;" &gt;%time:~0,5% == %a%&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;echo&lt;/span&gt;&lt;span style="font-size:85%;"&gt;  ALARM!!! Close this window to stop.&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);font-size:85%;" &gt;goto&lt;/span&gt;&lt;span style="font-size:85%;"&gt; top&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;Copy this code into a text file and name it Alarm.bat&lt;br /&gt;&lt;br /&gt;The code is pretty simple to follow. The important parts are the &lt;span style="color: rgb(0, 0, 102);"&gt;set /p&lt;/span&gt; command where I gather the desired time and then the if statement at the bottom. The :~0,5% part of the time variable means that only a piece of that variable is being used. I don't care to match up the exact time down to the millisecond. The funny looking symbols that are being echoed later on that same line are actually CTRL+G symbols. They caused the computers internal alarm to beep for the entire minute that matches with the time you enter.&lt;br /&gt;&lt;br /&gt;It might be ugly, but it works great. I was able to get that nap, and the alarm woke me up just fine!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1386561136029030105-7800840986607368486?l=scriptingmadness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingmadness.blogspot.com/feeds/7800840986607368486/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1386561136029030105&amp;postID=7800840986607368486' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1386561136029030105/posts/default/7800840986607368486'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1386561136029030105/posts/default/7800840986607368486'/><link rel='alternate' type='text/html' href='http://scriptingmadness.blogspot.com/2009/05/how-to-program-batch-file-alarm-clock.html' title='How to Program a Batch File Alarm Clock'/><author><name>r0ck3t3r</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_AiEN4RJa-v4/ShbrJxj8pYI/AAAAAAAAAPA/3feQEMFKSQo/s72-c/BatchAlarm.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1386561136029030105.post-848047677496101943</id><published>2008-07-02T22:44:00.001-05:00</published><updated>2009-05-28T22:20:35.858-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='batch'/><title type='text'>Windows Batch File Programming: Part one</title><content type='html'>The most basic aspect of network monitoring is checking to see if a host is online via pinging it. This can be done manually. Any task that can be done manually can be automated. The first thing I do is write out the steps of how it would be preformed manually. Let us say we wanted to check 3 websites to see if they are up. If we were to do this manually we would have to:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. Open a command prompt.&lt;br /&gt;2. Type Ping 4.2.2.2&lt;br /&gt;3. Review the results.&lt;br /&gt;4. Type Ping 4.2.2.15. Review the results.&lt;br /&gt;6. Type Ping 198.128.50.50&lt;br /&gt;7. Review the results.&lt;br /&gt;&lt;br /&gt;This is not too hard, but what if we had 50 hosts to check? That could get tiring. This is where automation/scripting steps in and takes the reins. You could write a simple script that does the same exact thing. It would look something like this in Windows Batch:&lt;br /&gt;&lt;br /&gt;ping 4.2.2.2&lt;br /&gt;ping 4.2.2.1&lt;br /&gt;ping 192.168.50.50&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This typed into notepad and saved as pinger.bat file would perform the same task much more easily, however let’s try something a little more powerful. I would hate to type ping for all 50 hosts. One of the favorite acronyms of most professional programmers I talk to is this. DRY! It means don't repeat yourself! We used the ping command 3 times. What if we had to ping 100 hosts? We can save ourselves some typing by using an iteration/loop. After all, is that not the whole idea of scripting? Windows Batch includes something we can use to do this. It is called the for loop.&lt;br /&gt;&lt;br /&gt;First you need to move the group of hosts to another text file. Make sure you keep it in the same directory as your batch file. It is nice to put it all in its own folder. Think of it as the workshop for your project. Open notepad and type the following:&lt;br /&gt;&lt;br /&gt;4.2.2.1&lt;br /&gt;4.2.2.1&lt;br /&gt;192.168.50.50&lt;br /&gt;&lt;br /&gt;Save this file as "host.txt" This should do it for the ip/host list. You can feel free to add as many hosts or ip addresses as you like. This list is way more maintainable than the method from before. It only includes the hosts are you interested in. It can also be used in other batch files or programs. This is all in the spirit of DRY!Now you will need to modify your pinger batfile. Open it in notepad and clear everything out. We can now perform our query with a single line of code. Type the following:&lt;br /&gt;&lt;br /&gt;For /F "tokens=*" %%i IN ("host.txt") DO ping %%i&lt;br /&gt;&lt;br /&gt;That’s it!! Save it. Execute it. Admire it! You have improved the pinger application with a script. But what the hell does it mean? For a closer look you can open the command prompt and type the following command for /? . The for command is very powerful and the best way to learn is to experiment with it and the different switches.Now you have a pinger utility that can ping all items in a list. While that is way better than doing it manually for a large number of hosts, we still only automated half of the process. Can you guess what the second part is? That’s right. I'm so proud of you to have made it this far. It is the review the results part. Programming is supposed to promote laziness. I have better things to do at my help desk than constantly ping the network to make sure it is up. We will go over methods to automate that part in the next edition of this article. Thanks for reading. I hope you were able to get something out of it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1386561136029030105-848047677496101943?l=scriptingmadness.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://scriptingmadness.blogspot.com/feeds/848047677496101943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1386561136029030105&amp;postID=848047677496101943' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1386561136029030105/posts/default/848047677496101943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1386561136029030105/posts/default/848047677496101943'/><link rel='alternate' type='text/html' href='http://scriptingmadness.blogspot.com/2008/07/windows-batch-file-programming-part-one.html' title='Windows Batch File Programming: Part one'/><author><name>r0ck3t3r</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
