Return code 0 on error

Hi running a bat script to delete some registry keys
I don't want the script to fail if it cant find a registry value

reg delete HKCRInstallerProductsB074548141BECBA438B53EC696D30CD8 /f
I need it to return error value of 0 if a key isn't found, can someone assist?



If that is the last command in the batch, just use

exit /b 0

as last statement to exit with a return value of 0.



If that is the last command in the batch, just use

exit /b 0

as last statement to exit with a return value of 0.



and if it is not the last line in the batch you can simply use labels, goto's and if statements; e.g. -



There are only a few situations where you should use labels. In general - no!





Share this

Related Posts

There was an error in this gadget