I am trying to use robocopy to update some internal AV clients that are not working. They will update once I the files are copied manually in.

I've tried the following robocopy script, but can't get it to execute.

for /f "usebackq tokens=*" %%T in ("serverlist.txt") do (robocopy C:\.. \\%%T\C$\.... /s /e >> script.txt)


Turns out this was a valid script I had called the file robocopy.bat and I was getting the error process already in use, I renamed the file and it worked.

  • 1
    I'd double check that your for command is running correctly by running it through an echo %%T command and make sure it is listing your server names as you would expect. Is it giving you an error message?
    – Nixphoe
    Aug 26, 2015 at 15:11
  • 1
    I added the echo and it reported an error, so changed the serverlist.txt file to the same location as the script and it seems to be working, thanks for the help.
    – JJJJNR
    Aug 26, 2015 at 21:29
  • The script is now running, however im getting the process cannot access the file because it is being used by another process. I've tried a retry (/r:2) but its still not working.
    – JJJJNR
    Aug 31, 2015 at 11:19
  • is the file being used by another process? Perhaps see what is being used and find out why. See if you can change the time of the robocopy or find out how to close the file.
    – Nixphoe
    Aug 31, 2015 at 13:42
  • I checked open files and there was one user on the folder, I've since closed it but it still won't run, and each time returns the same error, could it be the robocopy process itself.
    – JJJJNR
    Aug 31, 2015 at 14:57


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.