Page 1 of 1

simultaneous file copy

Posted: 27 Dec 2013 08:16
by technotika
Hi I have a script that requires multiple PC's to copy files from a server to their C drives. I can loop it in a list of hostnames but I want the file copy command to to cycle through the list of hostnames without waiting for the files to copy - hope that makes sense.

ECHO on
color 1f
pushd %~dp0

for /f %%A in (%~dp0hostnames.txt) do (

ECHO LISTING ONLINE HOSTNAMES.....
ping -n 1 %%A | find "Reply from"
if not errorlevel 1 echo %%A >> %~dp0online.txt
if errorlevel 1 echo %%A >> %~dp0offline.txt

CLS
)
echo ENTER ADMIN ACCOUNT...
pause
SET /P dollar=[user]
SET /P pword=[password]
cls
ECHO EXECUTING SILENT PROGRAM 3.2.17.17 / FILE COPY

for /f %%A in (%~dp0online.txt) do (

xcopy /herky cmd "%~dp0client.bat" "\\%%A\C$\windows\temp"
xcopy /herky cmd "%~dp0Lexacom.exe" "\\%%A\C$\windows\temp"
xcopy /herky cmd "%~dp0Lexacom3.cfg" "\\%%A\C$\windows\temp"


ECHO "INSTALLING LEXACOM 3 on %%A SEE (%~dp0%%A-log.txt)"

%~dp0psexec.exe \\%%A -u %dollar% -p %pword% "C:\windows\temp\client.bat" > %~dp0%%A-log.txt 2>&1


)

CLS
ECHO LIST OF HOSTNAME INSTALLS COMPLETE CHECK LOGS FOR ERRORS

pause

Re: simultaneous file copy

Posted: 27 Dec 2013 13:02
by penpen
I#m not sure, but do you search for something like this?

Code: Select all

for %%a in (1 2 3) do (start cmd /C "echo copy cmd pc %%a!&pause")


penpen