windows - Running a batch file to backup Desktop and My Documents to a shared location -
i have 50 machines on domain , wanted backup of desktop , documents folder shared drive on network.
i wrote batch file , added computer through gpo/schedule tasks. worked few of them of them pops question saying either cant create directory or whether directory or not , asks prompt "d"
please see running
echo off mkdir "\\serv\local_backup\%username%\desktop" mkdir "\\serv\local_backup\%username%\my documents" xcopy "%userprofile%\desktop" "\\serv\local_backup\%username%\desktop" /e /y /q xcopy "%userprofile%\documents" "\\serv\local_backup\%username%\my documents" /e /y /q exit
what best way achieve same goal less trouble?
is there way can pass on value d , press enter in code?
type
xcopy /?
it says in part
copies files , directory trees. note: xcopy deprecated, please use robocopy.
while there see /i switch.
/i if destination not exist , copying more 1 file, assumes destination must directory.
also specifing filenames works better.
xcopy "%userprofile%\desktop\*.*" "\\serv\local_backup\%username%\desktop\*.*" /e /y /q xcopy "%userprofile%\documents\*.*" "\\serv\local_backup\%username%\my documents\*.*" /e /y /q
so type
robocopy /?
and
robocopy.doc
Comments
Post a Comment