title: Timestamp in Batch File not Updating Properly
body: <p>I'll start off by saying that I'm very new to scripting...</p>
  
  <p>I'm trying to create a batch file that periodically pings a host. At the moment, I'm just testing it on my local PC. Here's what I've got so far:</p>
  
  <pre><code>@echo off
  
  set SERVERNAME=127.0.0.1
  set limit=3
  
  ECHO %date%, %time% Starting ping test to localhost&gt;&gt;c:\users\%username%\desktop\Pingtest.txt
  
  for /l %%X in (1,1,%limit%) do (
  
  ping %servername% -n 3 | FIND "Reply" &gt;&gt;c:\users\%username%\desktop\Pingtest.txt
  
  echo %time% &gt;&gt;c:\users\%username%\desktop\Pingtest.txt
  
  Timeout /t 5
  
  )
  
  Exit
  </code></pre>
  
  <p>However, the timestamp always stays the same. It should show the time as being ~5 seconds after (or however long the timeout value is set), but stays the same as the first timestamp. Here's an example of the output:</p>
  
  <pre><code>25/08/2015,  2:09:18.34 Starting ping test to localhost
  Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128
  Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128
  Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128
   2:09:18.34 
  Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128
  Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128
  Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128
   2:09:18.34 
  Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128
  Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128
  Reply from 127.0.0.1: bytes=32 time&lt;1ms TTL=128
   2:09:18.34 
  </code></pre>
  
  <p>Is there any way to get it to update with the proper time?</p>
  
  <p>As a side note, the "for /l %%X in..." I can't figure out what I should actually put in place of %%X. From Googling etc, I've seen people using different ones, but can't seem to figure out what it refers to. If someone could let me know about that as well, it'd be much appreciated.</p>
  
  <p>Thanks</p>