Hello a simple batch @echo off net use \\WS01\Win7-01$ echo %ERRORLEVEL% pause shows in echo errorlevel 2 if it running without debugger inside cmdebug the output of %ERRORLEVEL% is empty OS: Windows 7, 64 bit