title: Parse an environment variable in a Windows BAT script
body: <p>I'm trying to create a simple application launcher for the software Nuke that puts the path together by evaluating an environment variable.  The value of the variable is used in two ways.  First it's used as-is.  The second time I need to split the variable and use the first half.</p>
  
  <p>The env variable set for the system: </p>
  
  <blockquote>
    <p>NUKE_VERSION = 10.0v5</p>
  </blockquote>
  
  <p>The path to the application: </p>
  
  <blockquote>
    <p>C:\Program Files\Nuke10.0v5\Nuke10.0.exe</p>
  </blockquote>
  
  <p>The code below works fine on the cmd prompt:</p>
  
  <pre><code>FOR /F "delims=v tokens=1" %i IN ("%NUKE_VERSION%") DO set NUKE_MAJOR=%i
  "C:\Program Files\Nuke%NUKE_VERSION%\Nuke%NUKE_MAJOR%.exe"
  </code></pre>
  
  <p>But when I run a .bat with the code, it returns this error:</p>
  
  <blockquote>
    <p>NUKE_VERSIONi was unexpected at this time.</p>
  </blockquote>
  
  <p>Any insights into what is going on?  I could just do this in python, but something this simple I shouldn't have to, right?  Many thanks in advance.</p>