How do I copy files from one location to several machines using psexec and a textfile?

Posted on 2008-11-11
Last Modified: 2012-05-05
How do I copy files from one location to several machines using psexec and a textfile?
Question by:AndreIfill
    LVL 21

    Expert Comment

    Why bother using PSEXEC to copy?

    Command line:
    FOR /f %a in (machines.txt) do XCOPY /s /y \\server\share\folder \\%a\c$\folder\*.*

    Batch file
    FOR /f %%a in (machines.txt) do XCOPY /s /y \\server\share\folder \\%%a\c$\folder\*.*


    Author Comment

    Can you tell me what the %a is used for?
    LVL 21

    Accepted Solution

    In a FOR the %a represents a variable in this example each line in machines.txt is processed 1 by 1.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    If like me you are one who spends a lot of time working and scripting with cmd.exe, sometimes it is handy to be able to quickly view a calendar for a given month and year. This script will quickly do just that!  Save the code posted below to a .bat …
    This article was inspired by a question here at Experts Exchange ( The requirements stated in that question are (1) reduce the file size of a large number of…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now