title: Windows CMD - Find current baud rate of COM port
body: <p>I am trying to parse the out put of <code>MODE</code> command in command prompt and assign it to a variable.
  The out put of <code>mode</code> is as shown below,</p>
  <pre><code>PS C:\Users\test&gt; mode %COMPORT%
  
  Status for device COM5:
  -----------------------
      Baud:            9600
      Parity:          None
      Data Bits:       8
      Stop Bits:       1
      Timeout:         OFF
      XON/XOFF:        OFF
      CTS handshaking: OFF
      DSR handshaking: OFF
      DSR sensitivity: OFF
      DTR circuit:     OFF
      RTS circuit:     OFF
  </code></pre>
  <p>I'm trying to get the first line using <code>FIND</code> as shown below,</p>
  <pre><code>mode COM5 | find /I &quot;Baud&quot;
  </code></pre>
  <p>it says <code>FIND: Parameter format not correct</code></p>
  <p>btw, this is how the whole code looks like,</p>
  <pre><code>@echo off
  for /f &quot;tokens=3&quot; %%a in (
      'REG QUERY HKLM\HARDWARE\DEVICEMAP\SERIALCOMM'
  ) do set &quot;COMPORT=%%a&quot; 
  echo %COMPORT%
  
  for /f &quot;tokens=2&quot; %%a in (
      'MODE %COMPORT% | FIND /I &quot;Baud&quot;'
  ) do set &quot;SPEED=%%a&quot; 
  echo %SPEED%
  </code></pre>
  <p>But this is not working, what am i doing wrong?</p>