I have a simple batch-file which starts first veracrypt and after mounting another batch-file:
C:
cd C:\Program2\VeraCrypt
veracrypt /v \Device\Harddisk2\Partition1 /l L /a /p 123xyz /q
cd /D D:\backup
start_backup.bat
start_backup.bat
starts a backup using robocopy (Windows 10) which updates/copies files from one drive C to an external encrypted harddrive D respectively L (mount name).
If veracrypt can't mount the drive for any reason (e.g. there is no drive) the batch start_backup.bat
will be started without backup since encrypted drive is not accessible. How can I avoid the start of start_backup.bat
in case the drive couldn't be mounted?
The batch-file is written with commands of cmd.exe.
Simple way to do this is using operator:
&&
and||
...if !errorlevel! 0/1 else
as suggested by @Stephan...Where does goto eof return to
Operator/Syntax Redirection in bat/cmd