[Answered ]-Want to apply the try catch for the batch file(alternative of try catch)

2👍

There are no try-catch blocks in batch scripts. You need to use the errorlevel returned by a command to check whether it executed successfully or failed. Generally errorlevel 0 indicates that the command executed successfully, but the errorlevel can also depend on the command/program being executed.

Details about ERRORLEVEL.

ERRORLEVEL can be used as follows:

IF %ERRORLEVEL% NEQ 0 (do something)
👤r3ap3r

Leave a comment