I am trying to parse the out put of MODE
command in command prompt and assign it to a variable.
The out put of mode
is as shown below,
PS C:\Users\test> 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
I'm trying to get the first line using FIND
as shown below,
mode COM5 | find /I "Baud"
it says FIND: Parameter format not correct
btw, this is how the whole code looks like,
@echo off
for /f "tokens=3" %%a in (
'REG QUERY HKLM\HARDWARE\DEVICEMAP\SERIALCOMM'
) do set "COMPORT=%%a"
echo %COMPORT%
for /f "tokens=2" %%a in (
'MODE %COMPORT% | FIND /I "Baud"'
) do set "SPEED=%%a"
echo %SPEED%
But this is not working, what am i doing wrong?