+ Post New Thread
Results 1 to 8 of 8
Scripts Thread, copy script to copy a folder to muliple computers in Coding and Web Development; Need some help writing a script to copy a folder (with sub contents) to multiple remote machines. i have done ...
  1. #1

    Join Date
    Feb 2013
    Location
    Surrey
    Posts
    4
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Question copy script to copy a folder to muliple computers

    Need some help writing a script to copy a folder (with sub contents) to multiple remote machines.

    i have done it for files but how do you to it for folders help!!
    @Rem simple copy script for Windows Command Interpreter (cmd.exe) @echo Read in each hostname entry in the file hostnames.txt amd copy the local file to the c$ of each hostname

    FOR /F %%i in (hostnames.txt) do copy name.bmp \\%%i\"c$\Program Files\"

  2. #2

    X-13's Avatar
    Join Date
    Jan 2011
    Location
    /dev/null
    Posts
    9,033
    Thank Post
    591
    Thanked 1,945 Times in 1,345 Posts
    Blog Entries
    19
    Rep Power
    813
    If you have access to the server, you could do this with Group policy.

    Computer Preferances > files [I think]

    Put the source folder [on a shared drive] as \\server\share\folder\* and set the target as "%programFiles%\", I also usually set it as "apply once".

  3. #3

    Join Date
    Feb 2013
    Location
    Surrey
    Posts
    4
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    i was trying to use cmd instead
    getting the names from a txt file for the machines, then copy the folder to c:\Windows\System32\oobe

    somethng like this ( its wrong at the moment)
    FOR /F %%D in (hostnames.txt) do Xcopy /E / Y "c:\Info*.*" "c$\Windows\System32\oobe\" \\%%D

    i know you can to it like this

    Xcopy /E /Y "c:\MyProject\Sample*.*" "\Computer1\Sample\"
    Xcopy /E /Y "c:\MyProject\Sample*.*" "\Computer2\Sample\"
    Xcopy /E /Y "c:\MyProject\Sample*.*" "\Computer3\Sample\"
    Xcopy /E /Y "c:\MyProject\Sample*.*" "\Computer4\Sample\"

    but that will take to long, need it to get the names from a text file.

  4. #4

    X-13's Avatar
    Join Date
    Jan 2011
    Location
    /dev/null
    Posts
    9,033
    Thank Post
    591
    Thanked 1,945 Times in 1,345 Posts
    Blog Entries
    19
    Rep Power
    813
    If you run it in CMD what happens?

    Are there any error messages?

    I'm guessing it's a startup script, where is the source file located?

    If you change "C:\Windows\System32\oobe\" to "%windir%\system32\oobe\" does it work?

  5. #5

    Join Date
    Feb 2012
    Location
    London
    Posts
    30
    Thank Post
    0
    Thanked 2 Times in 2 Posts
    Rep Power
    5
    do you have remote ranger or anything like that? you may be able to use that without the use of scripts

  6. #6

    Join Date
    Feb 2013
    Location
    Surrey
    Posts
    4
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    no i dont

    i would like to write a script that way i can use it for other things
    Last edited by er22; 25th April 2013 at 12:32 PM.

  7. #7

    Join Date
    Feb 2013
    Location
    Surrey
    Posts
    4
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    its working FOR /F %%D in (hostnames.txt) do Xcopy /E /Y "c:\files\*" "\\%%D\c$\Windows\System32\oobe\"

  8. #8

    Join Date
    Mar 2012
    Location
    Devon
    Posts
    223
    Thank Post
    0
    Thanked 15 Times in 14 Posts
    Rep Power
    10
    Take a look at Robocopy. Superb for situations like this.

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 3
    Last Post: 25th April 2012, 11:26 AM
  2. need a script to copy a folder with shortcuts
    By jamin100 in forum Scripts
    Replies: 1
    Last Post: 4th September 2008, 07:38 PM
  3. VBS Script to copy a folder
    By FN-GM in forum Scripts
    Replies: 2
    Last Post: 23rd February 2008, 01:08 PM
  4. Replies: 21
    Last Post: 29th December 2007, 10:53 PM
  5. VB Script ti check for folder and then copy contents to PC
    By tosca925 in forum How do you do....it?
    Replies: 4
    Last Post: 2nd October 2006, 08:15 PM

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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