Jump to content

Recommended Posts

Posted

I have a file that i need copied to many destination folders (redirected desktop's) and a startup script hasn't worked.

 

Is there some application? or a script (foreach / for next loop?) that anyone has used that would work?

 

thanks

 

fooby

Posted

Sorted.

 

part1.cmd

IF (%1)==() GOTO usage
dir %1 /A:D /B > dir.txt
for /F "delims= tokens=1" %%a in (dir.txt) do call part2.cmd %1 %%a
GOTO End
:usage
ECHO Usage: part1.cmd 
:End

 

part2.cmd

if %2==bytes GOTO :End
copy "c:\folder\item.exe" %1\%2\ /Y
:End

 

 

Usage.

 

1. Place carefully on C:\temp (or whatever folder)

2. Modify part2.cmd (what you want to get done to each object)

3. C:\temp> part1 h:\staffdesktops

 

C:\temp>call part2.cmd h:\user1
C:\temp>if user1 == bytes GOTO :End
C:\temp>copy "c:\temp\item.exe" h:\user1\ /Y
       1 file(s) copied.

C:\temp>call part2.cmd h:\user2
C:\temp>if user2 == bytes GOTO :End
C:\temp>copy "c:\temp\item.exe" h:\user2\ /Y
       1 file(s) copied.

 

fooby

 

Keywords: One to many, many destinations, many folders

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...