[PATCH v4 1/2] cmd: refactored setting of 'errorlevel'