{"id":2539,"date":"2017-12-09T04:56:19","date_gmt":"2017-12-09T04:56:19","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=2539"},"modified":"2020-01-09T09:46:15","modified_gmt":"2020-01-09T09:46:15","slug":"check-the-exit-code-of-the-last-command-in-batch-file","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/check-the-exit-code-of-the-last-command-in-batch-file\/","title":{"rendered":"Check the exit code of the last command in batch file?"},"content":{"rendered":"<p><strong>rajeshkumar created the topic: check the exit code of the last command in batch file?<\/strong><\/p>\n<p>Test for a return code greater than or equal to 1:<\/p>\n<p>if ERRORLEVEL 1 echo Error<br \/>\nor<\/p>\n<p>if %ERRORLEVEL% GEQ 1 echo Error<\/p>\n<p>or test for a return code equal to 0:<\/p>\n<p>if %ERRORLEVEL% EQU 0 echo OK<\/p>\n<p>You can use other commands such as GOTO where I show echo<br \/>\nRegards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @<a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\"> twitter.com\/RajeshKumarIn<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>rajeshkumar created the topic: check the exit code of the last command in batch file? Test for a return code greater than or equal to 1: if ERRORLEVEL 1 echo&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[57],"tags":[333],"class_list":["post-2539","post","type-post","status-publish","format-standard","hentry","category-scripting","tag-command"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2539","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=2539"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2539\/revisions"}],"predecessor-version":[{"id":2540,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2539\/revisions\/2540"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=2539"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=2539"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=2539"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}