我发现了这个有用的命令,它非常有效。但是,我需要将其展开以查找特定的文件类型
>nul 2>nul dir /a-d "%OutputDirectory%\02_Processing.txt" "%OutputDirectory%\03_Proofs.txt" && (
mkdir "%ARCHIVE_FOLDER%\%DATETIMESTAMP%"
move "%OutputDirectory%\02_Processing.txt" "%ARCHIVE_FOLDER%\%DATETIMESTAMP%"
move "%OutputDirectory%\03_Proofs.txt" "%ARCHIVE_FOLDER%\%DATETIMESTAMP%"
move "%OutputDirectory%\04_Samples.txt" "%ARCHIVE_FOLDER%\%DATETIMESTAMP%"
echo Files moved to "%ARCHIVE_FOLDER%\%DATETIMESTAMP%"
) || (echo No file found)像这样的东西
>nul 2>nul dir /a-d "folderName\file1" or file2 or file3 && (echo Files exist) || (echo No file found)是否可以在一行中,我是否需要将其拆分为多行。
发布于 2017-04-13 00:20:11
dcg的建议是正确的选择。我有缺失的变量。所以答案应该是
>nul 2>nul dir /a-d "%OutputDirectory%\03_Proofs.txt" "%OutputDirectory%\04_Samples.txt" && (^
mkdir "%ARCHIVE_FOLDER%\%DATETIMESTAMP%"
move "%OutputDirectory%\02_Processing.txt" "%ARCHIVE_FOLDER%\%DATETIMESTAMP%"
move "%OutputDirectory%\03_Proofs.txt" "%ARCHIVE_FOLDER%\%DATETIMESTAMP%"
move "%OutputDirectory%\04_Samples.txt" "%ARCHIVE_FOLDER%\%DATETIMESTAMP%"
echo Files moved to "%ARCHIVE_FOLDER%\%DATETIMESTAMP%") || (echo找不到文件)
https://stackoverflow.com/questions/43373369
复制相似问题