Batch file 使用批处理将文件替换为更新版本

Batch file 使用批处理将文件替换为更新版本,batch-file,Batch File,我正在尝试使用批处理将多个文件替换为更新版本,但我当前的版本不起作用。新文件和旧文件之间的唯一区别是日期,然后我将循环它,因为要替换的文件目录稍微更改为c:\test3\hazards-file2-data.csv CLS set /p vtdate= Enter existing valid till date: set /p yesno= Confirm this is the correct valid till date?[y/n/c to cancel]: if "%yesno%"=

我正在尝试使用批处理将多个文件替换为更新版本,但我当前的版本不起作用。新文件和旧文件之间的唯一区别是日期,然后我将循环它,因为要替换的文件目录稍微更改为c:\test3\hazards-file2-data.csv

CLS
set /p vtdate= Enter existing valid till date:
set /p yesno= Confirm this is the correct valid till date?[y/n/c to cancel]:

if "%yesno%"=="n" goto VTD
if "%yesno%"=="y" goto VFD 
if "%yesno%"=="c" goto Home
if not "%yesno%"=="y"or"n"or"c" goto IED
pause
goto VTD

:VFD
set /p vfdate= Enter valid from date:
Set /p yesno= Confirm this is the correct valid from date?[y/n/c to       cancel]:

if "%yesno%"=="n" goto VFD
if "%yesno%"=="y" goto Copy 
if "%yesno%"=="c" goto Home
if not "%yesno%"=="y"or"n"or"c" goto VFD
pause
goto VFD

:Copy
cd c:\>replace c:\Test2\"%vfdate%"-hazards-File1-data.csv:\Test1\"%vtdate%"-hazards-File1-data.csv

没关系,我只是简化了我的思维,我使用了del,然后是copy,而不是replace函数del/f/q/c:\test2\%vtdate%“-hazards-file1-data.csv”,然后是“copy c:\test1”%vfd%“-hazrads-file1-data.csv”c:\test2'查看
xcopy/?
robocy/?
。谢谢您的关注。