findstr коды выхода/errorlevel
у меня есть программа, которая использует findstr, и когда строка нашел errorlevel возвращает 0 и когда строка не нашел errorlevel возвращает 1. Хорошо, я справлюсь с этим.
где проблема заключается в том, что я не могу найти никакой официальной документации о том, что каждый errorlevel средство findstr. Мне нужно знать, если что-нибудь еще для findstr может когда-нибудь вернуть errorlevel of 1, или если он возвращает только 1 когда строка не найдено.
ссылки на "официальную" документацию предпочтительны, если таковые имеются, но любой вклад был бы весьма признателен.
спасибо заранее!
2 ответов
http://ss64.com/nt/findstr.html говорит:
FINDSTR will set %ERRORLEVEL% as follows:
0 (False) a match is found in at least one line of at least one file.
1 (True) if a match is not found in any line of any file, (or if the file is not found at all).
2 Wrong syntax
An invalid switch will only print an error message in error stream.
это задокументировано в Dos 6.22 Help for FIND command.
│FIND exit codes
│
│The following list shows each exit code and a brief description of its
│meaning:
│
│0
│ The search was completed successfully and at least one match was found.
│
│1
│ The search was completed successfully, but no matches were found.
│
│2
│ The search was not completed successfully. In this case, an error
│ occurred during the search, and FIND cannot report whether any matches
│ were found.
│
│You can use the ERRORLEVEL parameter on the <If> command line in a batch
│program to process exit codes returned by FIND.