title: Redirect output of batch command to an if statement (and string error?)
body: <p>After a bit of research I've found what looks to be a good work around for getting the output of a batch command and setting it to a variable. I've used a bit of <a href="http://justgeeks.blogspot.com/2008/07/save-output-of-dos-command-to-variable.html" rel="nofollow">example code</a> from a blog: Just Geeks to start. My eventual goal is to detect the model of computer the script is run on and do something based on which model. After a bit of modification I have:</p>
  
  <pre><code>FOR /F "tokens=* skip=1 delims=" %%A in ('wmic csproduct get name') do ( 
  if %%A == "Vostro 430" goto vostro430
  if %%A == "Optiplex 380" goto optiplex380
  )
  exit
  
  :vostro430
  REM do some stuff here
  
  :optiplex380
  REM do some stuff here
  </code></pre>
  
  <p>Its useful to note that wmic csproduct get name > sometextfile.txt on a Vostro 430 (dell computer model) a text file that looks like this:</p>
  
  <pre><code>Name
  Vostro 430
  </code></pre>
  
  <p>So the code above "should" ignore the first line and compare "Vostro 430" in the if statements and then jump to one of the lables. It seems that I have some error though if I echo the out the batch script I can see that it is evaluating %A as a blank:</p>
  
  <pre><code>== "Vostro 430" goto vostro430
  == "Optiplex 380" goto optiplex380
  </code></pre>
  
  <p>Any ideas where I messed up? I suspect some sort of string or syntax issue but I haven't been able to pin it down.</p>