Let me do some tests with a .BAT file, all tests have been done with EXE files that return an errorlevel, and that's different. could be that the OS is starting the command interpreter (line cmd) and that it's giving back the errorlevel that the command interpreter gives (0 in this case) and not the .BAT that is running inside it. dirk
-------------------------------------------------------------------------------- From: Servers Alive Discussion List [mailto:salive@woodstone.nu] On Behalf Of Jason Passow Sent: Wednesday, December 09, 2015 6:15 PM To: Servers Alive Discussion List Subject: Re: [SA-list] ErrorLevel AGAIN Full path to the .bat file. C:\Program Files (x86)\CountError\CountError.bat no quotes or extra characters. The batch file is running because it writes results to a file (output.txt). That file is changing but the errorlevel is returned as 0 every time. Jason Passow Network Administrator http://www.mwsco.com jas...@mwsco.com ph: (507) 494-5178 fax: (507) 454-8104 Mississippi Welder Supply Co., Inc. Please consider the environment before printing this email. ____________________________________________________________________________________________________________________________________________________________________________________________________________________________ The information contained in this message is privileged and intended only for the recipients named. If the reader is not a representative of the intended recipient, any review, dissemination or copying of this message or the information it contains is prohibited. If you have received this message in error, please immediately notify the sender, and delete the original message and attachments. From: dirk <d...@woodstone.nu> To: Servers Alive Discussion List <salive@woodstone.nu> Sent: 12/9/2015 10:55 AM Subject: RE: [SA-list] ErrorLevel AGAIN  How are you calling the bat file in Servers Alive? -------------------------------------------------------------------------------- From: Servers Alive Discussion List [mailto:salive@woodstone.nu] On Behalf Of Jason Passow Sent: Wednesday, December 09, 2015 5:35 PM To: Servers Alive Discussion List Subject: Re: [SA-list] ErrorLevel AGAIN Mine returns in less than 3 seconds. I have changed the timeout to 30 with the same result. Jason Passow Network Administrator http://www.mwsco.com jas...@mwsco.com ph: (507) 494-5178 fax: (507) 454-8104 Mississippi Welder Supply Co., Inc. Please consider the environment before printing this email. ____________________________________________________________________________________________________________________________________________________________________________________________________________________________ The information contained in this message is privileged and intended only for the recipients named. If the reader is not a representative of the intended recipient, any review, dissemination or copying of this message or the information it contains is prohibited. If you have received this message in error, please immediately notify the sender, and delete the original message and attachments. From: Roderick Garcia <roderick.gar...@cancer.org> To: Servers Alive Discussion List <salive@woodstone.nu> Sent: 12/9/2015 10:20 AM Subject: RE: [SA-list] ErrorLevel AGAIN I had a similar issue and mine turned out to be the timeout setting with was at the default 5. I wasnââ¬â¢t allocating enough time for the check to complete. Thus a false return. Roderick Garcia | Senior Systems Support Engineer American Cancer Society, Inc. 8400 Silver Crossing Oklahoma City, OK 73132 cancer.org (http://www.cancer.org) | 1.800.227.2345 (http://www.facebook.com/americancancersociety?societysignature=facebook) (http://www.twitter.com/americancancer?societysignature=twitter) (http://www.youtube.com/user/AmerCancerSociety?societysignature=youtube) (http://www.linkedin.com/company/american-cancer-society?societysignature=linkedin) (http://www.cancer.org/) (http://charityreports.bbb.org/public/seal.aspx?ID=1413312005) This message (including any attachments) is intended exclusively for the individual to whom it is addressed and may contain proprietary, protected, or confidential information. If you are not the named addressee, you are not authorized to read, print, copy, or disseminate this message or any part of it. If you have received this message in error, please notify the sender immediately. From: Servers Alive Discussion List [mailto:salive@woodstone.nu] On Behalf Of Jason Passow Sent: Wednesday, December 09, 2015 9:50 AM To: Servers Alive Discussion List Subject: [SA-list] ErrorLevel AGAIN I have a check which always returns error level 0. It should not and from a command line it indeed does not. Using the Checkerrorlevel that comes with salive it does indeed show 0. Output .txt contains 2 for /F "delims=" %%a in (output.txt) do ( set "SHELL_EXIT_CODE=%%a" ) exit %SHELL_EXIT_CODE% Command line results: C:\Program Files (x86)\CountError\>CountError.bat C:\Program Files (x86)\CountError\>echo %errorlevel% 2 Jason Passow Network Administrator http://www.mwsco.com jas...@mwsco.com ph: (507) 494-5178 fax: (507) 454-8104 Mississippi Welder Supply Co., Inc. Please consider the environment before printing this email. ____________________________________________________________________________________________________________________________________________________________________________________________________________________________ The information contained in this message is privileged and intended only for the recipients named. If the reader is not a representative of the intended recipient, any review, dissemination or copying of this message or the information it contains is prohibited. If you have received this message in error, please immediately notify the sender, and delete the original message and attachments. To unsubscribe send a message with UNSUBSCRIBE in the subject line to salive@woodstone.nu If you use auto-responders (like out-of-the-office messages), make sure that they are not sent to the list nor to individual members. Doing so will cause you to be automatically removed from the list. To unsubscribe send a message with UNSUBSCRIBE in the subject line to salive@woodstone.nu If you use auto-responders (like out-of-the-office messages), make sure that they are not sent to the list nor to individual members. Doing so will cause you to be automatically removed from the list. To unsubscribe send a message with UNSUBSCRIBE in the subject line to salive@woodstone.nu If you use auto-responders (like out-of-the-office messages), make sure that they are not sent to the list nor to individual members. Doing so will cause you to be automatically removed from the list. No virus found in this message. Checked by AVG - www.avg.com (http://www.avg.com) Version: 2016.0.7294 / Virus Database: 4483/11146 - Release Date: 12/09/15 To unsubscribe send a message with UNSUBSCRIBE in the subject line to salive@woodstone.nu If you use auto-responders (like out-of-the-office messages), make sure that they are not sent to the list nor to individual members. Doing so will cause you to be automatically removed from the list. To unsubscribe send a message with UNSUBSCRIBE in the subject line to salive@woodstone.nu If you use auto-responders (like out-of-the-office messages), make sure that they are not sent to the list nor to individual members. Doing so will cause you to be automatically removed from the list. No virus found in this message. Checked by AVG - www.avg.com (http://www.avg.com) Version: 2016.0.7294 / Virus Database: 4483/11146 - Release Date: 12/09/15 To unsubscribe send a message with UNSUBSCRIBE in the subject line to salive@woodstone.nu If you use auto-responders (like out-of-the-office messages), make sure that they are not sent to the list nor to individual members. Doing so will cause you to be automatically removed from the list.