for /f "delims=" %%k in ('reg query HKCR /s ^| find /i "Baidu"') do (
set /a "startfour=%%k:~0,4%%"
echo The begining four characters of result string are as follows:
echo "%%startfour%%"
if "%%startfour%%" equ "HKEY" (
set "key=%%k%%"
echo "This is a key:"
echo "%%key%%"
) else (
set "keyvalue=%%k%%"
echo "This is a key value:"
echo "%%keyvalue%%"
rem I still don't find out a way about how to cut a key value substring out of a result string...
)