When multiple variables are defined at the beginning of the batch, a short definition form may be used by employing a replacement string.
@echo off
set "vars=_A=good,_B=,_E=bad,_F=,_G=ugly,_C=,_H=,_I=,_J=,_K=,_L=,_D=6
set "%vars:,=" & set "%"
for /f %%l in ('set _') do echo %%l
exit /b
_A=good
_D=6
_E=bad
_G=ugly
Note in the above example, variables are natively alphabetically sorted, when printed to screen.