_SAFEMODE — Indicates whether Windows was started in safe mode.

Syntax:
%_SAFEMODE

The documented return values are:

0Normal boot
1Clean boot
2Clean boot with network support