The %SAFEBOOT_OPTION%
variable only exists if you are currently booted into safe mode
(contains MINIMAL
) or safe mode with networking
(contains NETWORK
).
From Microsoft's Docs:
An environment variable is set when you use one of the Safe Boot options. The environment variable is SAFEBOOT_OPTION. This variable is set to either Network or to Minimal.
EDIT
Just tested the script below while running in safe mode:
@echo off
if /i "%SAFEBOOT_OPTION%"=="MINIMAL" echo We're in Safe Mode!
This script printed We're in Safe Mode!
to cmd as expected.