所以我试图在for循环中读取文件夹名称(bs000,bs001,...,bs104),我的问题是我似乎不知道如何添加前导零。这是一段代码。
FOR /L %X IN (0,1,104) DO (
robocopy E:\Bosphorus_3D_Face_DB\BosphorusDB\bs%X E:\Bosphorus_3D_Face_DB\bs%X *_CAU_A22A25_0.bnt)
我在cmd.exe中执行此操作
答案 0 :(得分:3)
setlocal enabledelayedexpansion
FOR /L %%X IN (0,1,104) DO (
set "var=00%%X"
set "var=!var:~-3!"
robocopy "E:\Bosphorus_3D_Face_DB\BosphorusDB\bs!var!" "E:\Bosphorus_3D_Face_DB\bs!var!" "*_CAU_A22A25_0.bnt"
)
endlocal