Este parâmetro para xcopy deve ajudar:
/I If destination does not exist and copying more than one file,
assumes that destination must be a directory.
Por sugestão adicionei /ad
para retornar somente dirs, mas continue sendo solicitado. O prompt sugere que ele queira saber se deve criar um arquivo ou diretório.
Como automatizo a resposta em um script em lote?
Este é o prompt:
Does \server\tf\POL-5TVK5J1\Administrator\Desktop specify a file name or directory name on the target (F = file, D = directory)?
Aqui está o meu script:
@echo off
md "\my server\tf\%computername%"
cd documents and settings
for /f %%u in ('dir /b /ad') do xcopy /s "c:\Documents and Settings\%%u\Desktop" "\my server\tf\%computername%\%%u\Desktop" /D /R
for /f %%u in ('dir /b /ad') do xcopy /s "c:\Documents and Settings\%%u\Favorites" "\my server\tf\%computername%\%%u\Favorites" /D /R
for /f %%u in ('dir /b /ad') do xcopy /s "c:\Documents and Settings\%%u\My Documents" "\my server\tf\%computername%\%%u\My Documents" /D /R
for /f %%u in ('dir /b /ad') do xcopy /s "c:\Documents and Settings\%%u\Personal" "\my server\tf\%computername%\%%u\Personal" /D /R
for /f %%u in ('dir /b /ad') do xcopy /s "c:\Documents and Settings\%%u\local settings\application data\Microsoft\Outlook" "\my server\tf\%computername%\%%u\Outlook" /D /R
barra esquecida no caminho do destino final "\my server\tf\%computername%\%%u\Desktop\"
for /f %%u in ('dir /b /ad') do xcopy /s "c:\Documents and Settings\%%u\Desktop" "\my server\tf\%computername%\%%u\Desktop\" /D /R
Tags prompt batch-file