3

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)

Edit.

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.

JJJJNR
  • 870
  • 6
  • 20
  • 32
  • 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 '15 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 '15 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 '15 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 '15 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 '15 at 14:57
  • I've never had that issue before, I doubt it's robocopy having the problem. Is it the same file each time? Is another local process running the file? – Nixphoe Aug 31 '15 at 15:17
  • This was such a nightmare in the end was the simplest fix, the reason the process was in use is because I called the robocopy file "robocopy" and itself was calling robocopy.exe so triggered the "already in use" message, so I renamed the file to XYZ.bat and it worked perfect.. /: – JJJJNR Sep 23 '15 at 15:22

0 Answers0