title: For /f batch loop fails with error ") was unexpected at this time."
body: <p>I'm writing what I thought would be a simple batch which will cycle through a .txt input file via a "FOR /F" to check a number of PC's for 3 file locations which will determine the OS or App version, Set a couple of Variable then rename a file and copy a new file in it's place..But I can't get it to work.
  The batch fails with ) was unexpected at this time</p>
  
  <p>Any assistance would be greatly appreciated.
  Here's the batch content</p>
  
  <pre><code>CD /D "C:\Win32app\Scripts\SEPXML"
  FOR /f "Tokens=1" %%a IN (List.txt) DO (
      Echo %%a
      If exist "\\%%a\c$\Documents and Settings\All Users\Application Data\Symantec\Symantec Endpoint Protection\CurrentVersion\Data\Config\SyLink.xml" (GoTo :Win2k3) else (GoTo :Next1)
      :Next1
      If exist "\\%%a\c$\Win32app\Symantec\SEPP\SyLink.xml" (GoTo :x86Serv) else (GoTo :Next2)
      :Next2
      If exist "\\%%a\c$\ProgramData\Symantec\Symantec Endpoint Protection\CurrentVersion\Data\Config\sylink.xml" (GoTo :Win2K8) else (GoTo :WriteError)
  
      :Win2k3
      Set SyLinkPath="\\%%a\c$\Documents and Settings\All Users\Application Data\Symantec\Symantec Endpoint Protection\CurrentVersion\Data\Config"
      Set OSVer=Win2k3
      GoTo :Run
  
      :x86Serv
      Set SyLinkPath="\\%%a\c$\Win32app\Symantec\SEPP"
      Set OSVer=Win2k3OLD
      GoTo :Run
  
      :Win2K8
      Set SyLinkPath="\\%%a\c$\ProgramData\Symantec\Symantec Endpoint Protection\CurrentVersion\Data\Config"
      Set OSVer=Win2k8
      GoTo Run
  
      :Run
      Ren %SyLinkPath%\SyLink.xml %SyLinkPath%\SyLink.old
      Robocopy C:\Win32app\Scripts\SEPXML\SyLink %SyLinkPath% /r:0 /W:0 /copyall /Tee /Log+:C:\Win32app\Scripts\SEPXML\Log\Results.txt
      GoTo End
  
      :WriteError 
      Echo %%a &gt;&gt;C:\Win32app\Scripts\SEPXML\Log\Error-Servers.txt
      :End
  )
  </code></pre>