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.