首页 > 解决方案 > 创建批处理文件以备份数据,并创建一个新目录以在每次运行时复制到

问题描述

我需要每次从同一个位置备份数据,但每次都备份到新创建的目录。我已经完成了创建新目录的部分,但是一旦创建了新目录,如何将数据复制到新目录?

这是我到目前为止所拥有的:

@echo off
set  counter=0
mkdir "c:\bginfo\dantest" 2>nul || goto :TryNext
:continue
rest of your code


goto :eof
:TryNext
set /a counter+=1
mkdir "c:\bginfo\dantest (%counter%)" 2>nul || goto :TryNext
goto :continue

假设数据在C:\Program\Data,我会做这样的事情吗:

copy c:\program\data\*.* c:\bginfo\dantest (%counter%)    

我不确定如何对新创建的位置进行编码。

标签: windowsbatch-filecmd

解决方案


推荐阅读