title: Concatenated text file output from single ECHO command gets characters inserted into string printed a second time after expected output
body: <p>I'm trying to create a batch file to insert a string from a <em>.txt</em> file at a specific place inside a string in 225 batch files - i.e., inserted into one line in the file at a specific place - but this question concerns the inserting part, and not the loop part, so I've left out the latter in my code example. It's also currently just displaying the text on-screen; not actually writing it to files.</p>
  
  <p>The target files are a bunch of launch <em>.bat</em> files used for running a game server cluster using a tool, so I will have to leave each of them with the same names as they start with (<em>Start XXYY.bat</em>). They contain something along these lines:</p>
  
  <pre><code>start /high ShooterGame\Binaries\Win64\ShooterGameServer.exe Ocean?ServerX=0?ServerY=0?AltSaveDirectoryName=0000?ServerAdminPassword=1234?MaxPlayers=50?ReservedPlayerSlots=25?QueryPort=50002?Port=5002?SeamlessIP=192.168.1.225?RCONEnabled=true?RCONPort=28450 -log -server -NoBattlEye
  exit
  </code></pre>
  
  <p>Where the <em>ServerX</em>, <em>ServerY</em>, <em>AltSaveDirectoryNamen</em> and all three <em>Port</em> settings are unique to each server, so these will have to remain unchanged.</p>
  
  <p>I need to add several more settings, from another <em>.txt</em> file in the final version, but for this example I will just put the additions (the word <strong>INSERT</strong> added after the <em>ReservedPlayerSlots</em> setting, while keeping each setting divided by question marks) directly into this script.</p>
  
  <p>My code is actually doing exactly what I want it to, but unfortunately it doesn't stop at that point, and decides to append more text than I wanted; specifically, everything I add to the <em>ECHO</em> command which is not a variable name.</p>
  
  <p>To clarify, I get the exact output that I want... Plus the unwanted addition of a bunch of question marks and the word <strong>INSERT</strong>, which apparently come from my <em>ECHO</em> command, but I just have no idea why they get re-added.</p>
  
  <p>My knowledge of batch scripting is fairly limited, so there might well be something basic that I've overlooked.</p>
  
  <p>I've tried replacing the question marks in the output (which are required to be questions marks in the final version) with normal letters instead, but it doesn't change the behaviour; they were still appended to the expected output, just like the question marks they replaced.</p>
  
  <pre><code>@ECHO OFF
  
  SET FileNum=0000
  REM I will have the code loop through 225 files (0000-1414) in the final version, but for test purposes I just set it to one single file number manually here.
  
  SET FileName=Start %FileNum%.bat
  REN "%FileName%" temp.txt
  FOR /F "tokens=1,2,3,4,5,6,7,8,9,10,11,12 delims=?" %%a IN (temp.txt) DO (
     ECHO %%a?%%b?%%c?%%d?%%e?%%f?%%g?INSERT?%%h?%%i?%%j?%%k?%%l
  )
  REN temp.txt "%FileName%"
  </code></pre>
  
  <p>I expect this code to output this:</p>
  
  <pre><code>start /high ShooterGame\Binaries\Win64\ShooterGameServer.exe Ocean?ServerX=0?ServerY=0?AltSaveDirectoryName=0000?ServerAdminPassword=1234?MaxPlayers=50?ReservedPlayerSlots=25?INSERT?QueryPort=50002?Port=5002?SeamlessIP=192.168.1.225?RCONEnabled=true?RCONPort=28450 -log -server -NoBattlEye
  exit
  </code></pre>
  
  <p>But what I am getting is this:</p>
  
  <pre><code>start /high ShooterGame\Binaries\Win64\ShooterGameServer.exe Ocean?ServerX=0?ServerY=0?AltSaveDirectoryName=0000?ServerAdminPassword=1234?MaxPlayers=50?ReservedPlayerSlots=25?INSERT?QueryPort=50002?Port=5002?SeamlessIP=192.168.1.225?RCONEnabled=true?RCONPort=28450 -log -server -NoBattlEye
  exit???????INSERT?????
  </code></pre>
  
  <p>Which is the expected output, but with the unexpected re-addition of every symbol in the <em>ECHO</em> command which did not designate a variable at the end of the output (in this case <strong>???????INSERT?????</strong>), just after the <strong>exit</strong>.</p>
  
  <p>I'm stumped... I hope someone has an idea what I'm doing wrong here.</p>