You should use WebDeploy to backup the contents before in case of failure. We try to avoid applying partial changes but that is not always possible. If there is a failure you can then apply the backed up state from the package or archive you took before making the changes.
Using %ERRORLEVEL% I believe you can see if there is a failure.