This is a general topic to discuss on ERRORLEVEL returned by executables in Windows. I am writing a script to install Apache HTTP server as a windows service.
httpd -k install
The httpd executable returns
- ERRORLEVEL 1 when there is an error in config file.
- ERRORLEVEL 2 when there is already a service installed.
- ERRORLEVEL 0 for success.
Is it ok to handle errors based on the ERRORLEVEL returned by the executables in general? Do we need to relly on other means to handle return codes of commands that we run in our batch scripts