在Windows批处理中将文件移动到目标日期

时间:2018-01-22 23:04:01

标签: windows batch-file

我想在给定日期从源位置移动一些文件,这些文件将被传递给批处理的参数识别。 每当我要执行脚本时,我都会收到以下错误。

D:\Adaptiv_Calib_Movement.bat XXXX 20170201
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.

我很确定move命令会抛出此错误但无法修复它。任何人都可以协助我解决它吗?代码片随附于此。

set inDate=%2%
set year=%inDate:~0,4%
set month=%inDate:~4,2%
set day=%inDate:~6,2%

cd /D D:/Adaptiv/EndOfDay

:: switch on the input parameter
IF "%1"=="XXXX" GOTO XXXX


:INVALIDPARAM
ECHO Invalid Parameter: Script was called with an invalid parameter >> "%log%"
exit 1

:NOPARAM
ECHO Invalid Parameter(s): Script was called with 0 or 1 parameters (2 required - Action and Reference Date) >> "%log%"
exit 1

:XXXX
ECHO Initiating %1 files movement  >> "%log%"

ECHO !year!-!month!-!day! >> "%log%"

::Move each trade file from the Source Folder to the Destination Folder

move "%SourceFolder%\CVA_Calib_!year!-!month!-!day!*dat" %DestinationFolder%
move "%SourceFolder%\CVA_Calib_!year!-!month!-!day!*txt" %DestinationFolder%
move "%SourceFolder%\PFE_CALIB_DAT_!year!-!month!-!day!*dat" %DestinationFolder%
move "%SourceFolder%\PFE_CALIB_DAT_!year!-!month!-!day!*txt" %DestinationFolder%

1 个答案:

答案 0 :(得分:0)

我要在黑暗中扔石头,希望能打一只猫。我会看看我是否可以在这个答案中解决你的问题,而不进行任何测试。

我看不到您设置pd.merge(df1, df2, on = "Req", )%SourceFolder%的位置!%DestinationFolder%, you usein expansion and not setlocal enabledelayedexpansion`让我觉得您没有复制整个脚本。

and I do not see that you have