【发布时间】:2015-04-23 20:12:44
【问题描述】:
我必须完成一项任务,在 //Traning/Biz 中有一些带有前缀命名当前日期的 xml 文件,例如 201504140157034_{hgds}.xml。 我需要创建一个批处理脚本,它可以在同一网络文件夹上创建一个具有当前日期名称的 zip 文件,并将所有当前日期文件压缩到该文件中。
我找到了下面的代码, 请帮我实现它
提前致谢:)
@echo off
:: variables
set drive=G:\Backup
set backupcmd=xcopy /s /c /d /e /h /i /r /y
echo ### Backing up My Documents...
%backupcmd% "%USERPROFILE%\My Documents" "%drive%\My Documents"
echo ### Backing up Favorites...
%backupcmd% "%USERPROFILE%\Favorites" "%drive%\Favorites"
echo ### Backing up email and address book (Outlook Express)...
%backupcmd% "%USERPROFILE%\Application Data\Microsoft\Address Book" "%drive%\Address Book"
%backupcmd% "%USERPROFILE%\Local Settings\Application Data\Identities" "%drive%\Outlook Express"
echo ### Backing up email and contacts (MS Outlook)...
%backupcmd% "%USERPROFILE%\Local Settings\Application Data\Microsoft\Outlook" "%drive%\Outlook"
echo ### Backing up the Registry...
if not exist "%drive%\Registry" mkdir "%drive%\Registry"
if exist "%drive%\Registry\regbackup.reg" del "%drive%\Registry\regbackup.reg"
regedit /e "%drive%\Registry\regbackup.reg"
:: use below syntax to backup other directories...
:: %backupcmd% "...source directory..." "%drive%\...destination dir..."
【问题讨论】:
-
检查这是否对您有帮助:stackoverflow.com/questions/28043589/…
-
@npocmaka 谢谢!但我是批处理脚本的新手,所以无法准确了解
标签: batch-file command-line cmd command-prompt