Sometimes it is important to back up all the files with permission, the batch files can throw an error that "you do not have auditing permission" to copy files like MDF which are Database actual data files. This kind of files is very heavy on security if a user running the batch file does not have administrative permission the Robocopy .bat file would emit an error and stop for 30 seconds. This error keeps on looping until you do this:
The /SEC or /COPYALL will grant file permission. This happens when file as has different permission and you want the file to have same permission in a copied directory.
#it is always good to write the output to a log file for review. This is important when you have an error and would like to review.
You do this by including /SEC or /COPYALL at the end of lines of code.
Another tip is to start the CMD console as an administrator and the error would go away.
Another important tip is when you have spaces in the path, make sure you wrap the path in "path" and escape character like this:
Instead of c:/foler do this instead, c://folder because it is an absolute path, the system would read a path different from code. make sure you research about absolute paths.