我正在尝试批处理备份工作服务器上的文件夹. (请参阅附件链接) 错误提示参数数量无效"
I am trying to get a batch going to backup a folder on a work server. (Please see attached link) Bat Error "invalid number of parameters"
长话短说-我需要使用脚本为每个备份命名一个新文件夹,建议使用"md new_folder",但似乎无法获取上下文或如何将其放入代码中.
Long story short - I need the script to name a new folder for each backup, which "md new_folder" was suggested, but I cannot seem to get the context or how to place it into the code.
@echo This will now create a new backup of S:\Internal Auditor\9 - September 14 @echo off :: variables set SRCFOLDER="S:\Internal Auditor\9 - September 14" set DESTFOLDER="S:\Internal Auditor\2014\9 - Sept Backup" set folder=%date:~5,2%-%date:~8,2%-%date:~0,4% set backupcmd=/W /E /H /V /C /Z /I /F /J /R /Y echo ######## PLEASE WAIT SYSTEM BACKINGUP SOME DATA######## "md new_folder" xcopy %SRCFOLDER% %DESTFOLDER% %backupcmd% echo !!!!!!!!BACKUP COMPLETED THANKS!!!!!!!!!!!!!! @pause任何帮助将不胜感激!
---------- 我尝试了几行代码,使我慢慢靠近:----------
---------- I tried a line of code that slowly got me closer:----------
@echo This will now create a new backup of S:\Internal Auditor\9 - September 14 @echo off :: variables set SRCFOLDER="S:\Internal Auditor\9 - September 14" set DESTFOLDER="S:\Internal Auditor\2014\9 - Sept Backup" set folder=%date:~5,2%-%date:~8,2%-%date:~0,4% md "%DESTFOLDER%\%folder%" set backupcmd=/W /E /H /V /C /Z /I /F /J /R /Y echo ######## PLEASE WAIT SYSTEM BACKING UP SOME DATA######## xcopy %SRCFOLDER% "%DESTFOLDER%\%folder%" %backupcmd% echo !!!!!!!!BACKUP COMPLETED THANKS!!!!!!!!!!!!!! @pause但是-我得到以下输出:
This will now create a new backup of S:\Internal Auditor\9 - September 14 Access is denied. Error occurred while processing: S:\Internal. A subdirectory or file Auditor\2014\9 already exists. Error occurred while processing: Auditor\2014\9. A subdirectory or file - already exists. Error occurred while processing: -. A subdirectory or file Sept already exists. Error occurred while processing: Sept. A subdirectory or file Backup\9/-9/-Tue already exists. Error occurred while processing: Backup\9/-9/-Tue . ######## PLEASE WAIT SYSTEM BACKING UP SOME DATA######## Invalid number of parameters !!!!!!!!BACKUP COMPLETED THANKS!!!!!!!!!!!!!! Press any key to continue . . .
---------- 我尝试了一段逐渐让我靠近的代码:----------
----------EDIT 2: I tried a line of code that slowly got me closer:----------
我遵循了我在网上找到的建议和一些东西,现在到了出现一些错误的地步:
I have followed the suggestions and some things I found online, and now I am to the point where I am getting a few errors:
md "S:\Internal Auditor\~\09/12/2014" A subdirectory or file S:\Internal Auditor\~\09/12/2014 already exists.并且:
xcopy "S:\Internal Auditor\9 - September 14 S:\Internal Auditor\2014\9 - Sept Backup\09/12/2014 /W /E /H /V /C /Z /I /F /J /R /Y /D File not found - 09/12/2014 /W /E /H /V /C /Z /I /F /J /R /Y /D这是我的代码:
This is my code:
@echo This will now create a new backup of S:\Internal Auditor\9 - September 14 Rem Backup 9 - September 14 @echo :: variables set "SRCFOLDER=S:\Internal Auditor\9 - September 14" set "DESTFOLDER=S:\Internal Auditor\2014\9 - Sept Backup" set folder=%date:~4% md "%DESTFOLDER%\%folder%" set backupcmd=/W /E /H /V /C /Z /I /F /J /R /Y /D @echo ######## PLEASE WAIT SYSTEM BACKING UP SOME DATA######## xcopy "%SRCFOLDER% %DESTFOLDER%\%folder% %backupcmd%" @echo !!!!!!!!BACKUP COMPLETED THANKS!!!!!!!!!!!!!! @pause此外,当我运行代码时,它将创建一个新目录〜\ 09 \ 12 \ 2014而不是所需的〜\ 09/12/2014. 澄清: 它会创建3个新的子目录,而不是一个新的子目录.
Also, when I run the code, it makes a new directory ~\09\12\2014 instead of the desired ~\09/12/2014. Clarification: It makes 3 new subdirectories instead of one new subdirectory.
推荐答案好.有一些错误:
set SRCFOLDER="S:\Internal Auditor\9 - September 14" set DESTFOLDER="S:\Internal Auditor\2014\9 - Sept Backup"必须为(安全方法,在SRCFOLDER和DESTFOLDER的开头添加第一引号):
Must be (safe method, adding first quote at start of SRCFOLDER and DESTFOLDER):
set "SRCFOLDER=S:\Internal Auditor\9 - September 14" set "DESTFOLDER=S:\Internal Auditor\2014\9 - Sept Backup"更多推荐
每个备份CMD的新文件夹
发布评论