为什么要在FORFILES中使用批处理文件跳过命令?

问题描述 投票:0回答:1

想问一下,下面是我的代码...

time /t > c:\logs.txt
date /t >> c:\logs.txt

pushd \\172.31.100.101\dir1\dir2

set sour2ndP=%CD%\Recon1
set dest2ndP=%CD%\Recon2

set sour2ndC=%CD%\Recon3
set dest2ndC=%CD%\Recon4

set sour3rd=%CD%\Recon5
set dest3rd=%CD%\Recon6

set sour4th=%CD%\Recon7
set dest4th=%CD%\Recon8

set sour5th=%CD%\Recon9
set dest5th=%CD%\Recon10

FORFILES /p %sour2ndP% /M *.* /C "cmd /c xcopy /y /z /f @file %dest2ndP% >> c:\logs.txt" /D +0
FORFILES /p %sour2ndC% /M *.* /C "cmd /c xcopy /y /z /f @file %dest2ndC% >> c:\logs.txt" /D +0
FORFILES /p %sour3rd% /M *.* /C "cmd /c xcopy /y /z /f @file %dest3rd% >> c:\logs.txt" /D +0
FORFILES /p %sour4th% /M *.* /C "cmd /c xcopy /y /z /f @file %dest4th% >> c:\logs.txt" /D +0
FORFILES /p %sour5th% /M *.* /C "cmd /c xcopy /y /z /f @file %dest5th% >> c:\logs.txt" /D +0

popd

下面是logs.txt

04:25 AM
Tue 12/09/2023 
Z:\Recon3\bbb.dat -> Z:\Recon4\bbb.dat
1 File(s) copied
Z:\Recon5\ccc.dat -> Z:\Recon6\ccc.dat
1 File(s) copied
Z:\Recon7\ddd.dat -> Z:\Recon8\ddd.dat
1 File(s) copied
Z:\Recon9\eee.dat -> Z:\Recon10\eee.dat
1 File(s) copied

我的问题是为什么批处理脚本会跳过' 经济1 至 经济2'线? 如果我手动执行,它不会跳过 但如果使用任务调度程序,' 康1到 econ2' 行总是被跳过 提前谢谢

batch-file command-line forfiles
1个回答
0
投票
pushd \\172.31.100.101\dir1\dir2&timeout /T 1 >nul
© www.soinside.com 2019 - 2024. All rights reserved.