Batch file 从多个目录复制一些文件夹

Batch file 从多个目录复制一些文件夹,batch-file,copy,Batch File,Copy,我想在批处理文件中复制机器所有本地用户的“桌面”文件夹 并将其放入如下目录:\MachineName\Username\ 例如: C:\Documents and Settings\VariableFolder1\Desktop\ 在 SomeFolder\%computername%\可变文件夹1\Desktop\ 是“VariableFolder”给了我一些问题…:( 我已经有了这个,但它会将所有文件复制到%computername%文件夹中 @echo OFF setlocal Enabl

我想在批处理文件中复制机器所有本地用户的“桌面”文件夹 并将其放入如下目录:\MachineName\Username\

例如:

C:\Documents and Settings\VariableFolder1\Desktop\

SomeFolder\%computername%\可变文件夹1\Desktop\

是“VariableFolder”给了我一些问题…:(
我已经有了这个,但它会将所有文件复制到%computername%文件夹中

@echo OFF
setlocal EnableDelayedExpansion
FOR /R "C:\Documents and Settings\" %%G IN (.) do (
xcopy "%%G\Desktop\*.*" "\\OneNas\Profil Windows\%COMPUTERNAME%\" /E /I /Y
)
有人能帮我吗?:)

谢谢

好的,我得到了答案:)

这就是我想要的:

@echo OFF
setlocal EnableDelayedExpansion
FOR /R "C:\Documents and Settings\" %%G IN (.) do (
set user=%%G
xcopy "%%G\Bureau\*.*" "\\SomeNas\Profil Windows\%COMPUTERNAME%\!user:~26!\Bureau" /E /I /Y
)