我正在尝试使批处理文件自动备份特定服务器目录中的特定文件。我一直在提示要在目标上指定文件名或目录名,并且必须手动键入D才能完成脚本。有没有一种方法可以使这一步骤自动化,因为这样我的备份将无需任何输入即可运行。
脚本代码
ECHO
xcopy "\\Sourceserver\sourcesubfolder\sourcesubfolder\filetobecopied.xlsx" "\\newServer\newsubfolder\newfilelocation\"\. /i /Y
xcopy "\\Sourceserver\sourcesubfolder\sourcesubfolder\filetobecopied.xlsx" "\\secondnewserver\secondnewsubfolder\secondnewlocation\"\. /Y
BREAK>"\\locationofbackuplog\Backup_log.LOG"
SET LOGFILE="\\locationofbacklog\Backup_log.LOG"
ECHO Successful File Transfer Run: %DATE% at %TIME% >>%LOGFILE%
脚本问题
xcopy "\\Sourceserver\sourcesubfolder\sourcesubfolder\filetobecopied.xlsx" "\\newServer\newsubfolder\newfilelocation\"\. /i /Y
Does \\newServer\newsubfolder\newfilelocation\\. specify a file name
or directory name on the target
(F = file, D = directory)?
我尝试在行的末尾添加/ i,并将\添加到指向新位置的链接的末尾,但是都没有用。
任何建议或反馈将不胜感激。谢谢!