Hello,
Xcopy exit code 4 means "Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line."
So I suggest you to check your drive name or run it manually for testing .
If the Answer is helpful, please click "Accept Answer" and upvote it.