Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
谁能帮我解决这个问题?
例如:
FolderA包含123.txt.
FolderA
123.txt
FolderB包含FolderB1, FolderB2, etc.
FolderB
FolderB1, FolderB2, etc.
我想将文件复制FolderA到FolderB1, FolderB2, etc.使用批处理文件。
使用 for 循环遍历目标目录。
FOR /D %%d IN (\Path\to\FolderB\*) DO copy \Path\to\FolderA\123.txt "%%~d"
pushd "\Path\to\folderB" for /r /d %%a in (*) do cd "%%~fa" & copy "\Path\to\FolderA\123.txt" popd