+ Post New Thread
Results 1 to 3 of 3
Scripts Thread, Robocopy and For loops in batch file in Coding and Web Development; Hi everyone, need some help or guidance I am using the following from a command line to copy file to ...
  1. #1

    Join Date
    Feb 2008
    Location
    Gloucester
    Posts
    36
    Thank Post
    6
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Red face Robocopy and For loops in batch file

    Hi everyone, need some help or guidance

    I am using the following from a command line to copy file to multiple remote computers :-

    robocopy.exe c:\file_ini "\\c5-01\c$\Program Files\usbdlm" usbdlm.ini

    I want to use a For /f loop to call the computers from a txt file, as I have 100 or so computers to push out the file to.

    Need some help with syntax

  2. #2

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,156
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    Code:
    for /f %%i in (c:\temp\comps.txt) do copy /y c:\file_ini "\\%%i\c$\Program Files\usbdlm\usbdlm.ini"
    Assuming you have
    comp1
    comp2

    etc in c:\temp\comps.txt

    I've put copy instead of robocopy because I don't think you need robocopy to do what you're trying to do but I hope this points the right way!

  3. Thanks to srochford from:

    barrystone (19th April 2010)

  4. #3

    Join Date
    Feb 2008
    Location
    Gloucester
    Posts
    36
    Thank Post
    6
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Steve

    Many thanks for quick response. It has certainly pointed the way

    I modified slightly as follows

    for /f %%i in (c:\temp\comps.txt) do robocopy.exe c:\file_ini "\\%%i\c$\Program Files\usbdlm" usbdlm.ini

    Works a treat

    Regards

    Barry

SHARE:
+ Post New Thread

Similar Threads

  1. Batch File (select random file) help
    By fil_b in forum Windows Server 2000/2003
    Replies: 5
    Last Post: 5th November 2009, 04:13 AM
  2. batch file comman
    By jussy65 in forum Scripts
    Replies: 3
    Last Post: 13th August 2008, 07:10 AM
  3. Robocopy & long file names
    By cheryl in forum Windows
    Replies: 2
    Last Post: 18th January 2008, 10:27 PM
  4. Pass £ in batch file
    By meastaugh1 in forum Windows
    Replies: 2
    Last Post: 17th January 2008, 08:02 PM
  5. batch file help
    By beeswax in forum Scripts
    Replies: 9
    Last Post: 3rd March 2006, 07:48 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •