batch regex the output of reg query command to a variable

try this:

@echo off &setlocal
for /f "tokens=2*" %%a in ('reg query HKLM\System\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile /v EnableFirewall') do set "var=%%b"
if "%var%"=="0x1" (do this) else do that

This should work for you:

for /f "tokens=3" %%x in ('reg query HKLM\System\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile /v EnableFirewall') do set FWSTATUS=%%x

If testing from the command line, change the %%x to %x instead.