Friday, December 7, 2018

windows 7 - Trouble in using Xcopy to copy to a network path in batch file


Code:


::CopyTest.bat
@ECHO
echo 123>>%temp%\MBDocuments.txt
xcopy "C:\Users\Foo\Documents\" pushd "X:\foo team\Team Members\foo\Documents"
del /q %temp%\MBDocuments.txt
pause

So I have another script that pulls this for percentages but it will not execute the above script here is the output.


Invalid Number of Parameters

Can someone please tell me what I'm doing wrong?


Is it because I'm pushing to another directory on the network?


I have Privileges across the companies network and access to the drive im backing up to.


At first I thought it was the arguments I was using. But its still Saying Invalid Parameters.


Answer



Never mind after some more research I just used Robocopy and used the following code which worked.


::CopyTest.bat
@ECHO
echo 123>>%temp%\MBDocuments.txt
robocopy C:\Users\foo\Documents\ "X:\foo team\Team Members\foo\Support Desktop" /e /b /xo
del /q %temp%\MBDocuments.txt
pause

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...