The Computer Oracle

Get exit status of last executed command in Windows?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Track title: CC F Haydns String Quartet No 53 in D

--

Chapters
00:00 Get Exit Status Of Last Executed Command In Windows?
00:10 Accepted Answer Score 30
00:29 Answer 2 Score 1
00:41 Thank you

--

Full question
https://superuser.com/questions/123008/g...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows #commandline #unix

#avk47



ACCEPTED ANSWER

Score 30


Use the errorlevel environment variable:

echo %errorlevel%

This question on stackoverflow has more detailed information.




ANSWER 2

Score 1


On Powershell you can use:

$LastExitCode

variable.