Looping through Command Line Arguments
For checking command-line arguments, you can use the for statement. Here is an example of how to loop through the arguments of a command line using the ‘for’ statement.
for ((c=1; c<=7; c++)) do echo "Welcome $c times" done
Output:
Batch Script – Return code
Return codes are the codes returned by programs when they are executed. If the command line is successful, it should return zero; if it is not successful, it should return non-zero. If the test fails, a non-zero value indicates the error number, and the user can attempt to resolve it by navigating to the error message.
The test may also return an exit code. A program’s or utility’s exit code usually appears when it finishes or terminates.
The list below includes some of the non-zero exit codes (with their respective errors) that programs may return
Error Code | Description |
---|---|
0 | Successful completion of the program. |
1 | This error indicates that the Windows command prompt has attempted to execute an unrecognized action |
2 | An error indicating that the file could not be found in the specified location |
3 | An error message indicated that the specified path could not be found. |
5 | An indication that the user is not authorized to access the resource |
90090×2331 | This error occurs when you misspell the command, application name, or path when configuring an Action. |
2212254950xC0000017-1073741801 | The error message tells you that Windows has run out of memory. |
32212257860xC000013A-1073741510 | This indicates that the user terminated the application |
32212257940xC0000142-1073741502 | The message indicating that the application was launched on a desktop to which the current user doesn’t have access |
Contact Us