Why does echo not change the %ERRORLEVEL%?

The %ERRORLEVEL% contains the status code of the previously run command. If the command completed successfully the code will be 0, otherwise it will be something else. So then consider the following:

> cd foo #there is no foo The system cannot find the path specified. #expected > echo %ERRORLEVEL% 1 #expected > echo %ERRORLEVEL% 1 #unexpected 

Why isn't the second echo returning 0? I would expect that since the first echo completed successfully the %ERRORLEVEL% would be changed to 0 and the second echo would print 0.

Replay

Category: command line Time: 2016-07-29 Views: 4

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.282 (s). 12 q(s)