echo %ERRORLEVEL%
From TechNet, Command shell overview:
"%ERRORLEVEL% ... Returns the error code of the most recently used command. A non zero value usually indicates an error."
To test for specific error levels in batch files, you may find this knowledgebase article useful.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…