ID:1420942
 
Well, what I'm trying to do is take everything from every users My Documents folder and put it somewhere else to back it up. I can't get past this invalid amount of parameters error and when I echo the xcopy it looks funky. Anybody got any good experience with this?

@echo off
echo This script will copy all of the files from my documents onto a C drive.
pause
md "C:\TestForWork"
pause
for /D /r %%G in ("C:\Users") DO for /D /r %%H in ("%%G\My Documents\") do xcopy "%%H" /e /y "C:\TestForWork"
pause
XCOPY "C:\USERS" "C:\TESTFORWORK" /D /E /C /R /I /K /Y


have you tried that??
I could be mistaken but the issue could be that it should be displayed as so:

for /D /r %%G in ("C:\Users") DO for /D /r %%H in ("%%G\My Documents\") do xcopy "%%H" "C:\TestForWork" /e /y


But I could be mistaken.
Nope, still says invalid number of parameters. You can run it on your computer and see if it does the same.
Will do, I'll get back to you in a bit. I'm gonna go to Jack in the Box real quick :)
Alright cool, thanks. In my head this should work, I don't see why it wouldn't. Logically it just... should lol
for /f "tokens=*" %%G in ('dir /b /a:d "C:\Users\*"') do xcopy "C:\Users\%%G" "C:\TestForWork\%%G" /e /y /i


Couldn't tell you why the original doesn't work, but the above seems to (courtesy of ss64).

Google "batch delayed expansion" for a fun read.

If all of your machines are running Windows 7+, I would recommend switching to Windows PowerShell.
I forgot to reply back, but thanks a lot DC, this worked! Rest awesomely to know that you helped field techs refresh health care computers faster! Sadly some machines are still going to need to be XP because software they use is not compatible with 7. But we're trying to move them toward 7 and modernize them out of the DOS age lol.