0

Trying to simply this .bat file I have.

I have a .bat file on multiple clients that the users run from a shortcut that performs a certain task. On certain days I need to modify the .bat file on all of the remote clients.

I would like to just modify the .bat file (keeping it named the same) in one location and then send that modified file out to all of the clients (over writing the existing copy) by running a .bat file myself.

Here is what I have so far. I was wanting a more elegant way of doing this. Maybe creating a file to read with all of the clients and then the .bat file do a 'for loop' possibly, but I have no idea.

@echo on
SET client1=\\deptpc1\c$\dicom
SET client2=\\deptpc2\c$\dicom
SET client3=\\deptpc3\c$\dicom
SET client4=\\deptpc4\c$\dicom
SET client5=\\deptpc5\c$\dicom
SET client6=\\deptpc6\c$\dicom
SET client7=\\deptpc7\c$\dicom
SET client8=\\deptpc8\c$\dicom
SET client9=\\deptpc9\c$\dicom
SET client10=\\deptpc10\c$\dicom
SET client11=\\deptpc11\c$\dicom
SET client12=\\deptpc12\c$\dicom
SET sandbox=\\SERVER\sandbox$\backups\scripts
goto code
this file deletes the .bat file in the dicom dir and copies the .bat file from \\server\sandbox$\backups\scripts\A2
for each CD ripper PC
:code
net use %client1% Pa$$worm /user:deptpc1\user1
net use %client2% Pa$$worm /user:deptpc2\user1
net use %client3% Pa$$worm /user:deptpc3\user1
net use %client4% Pa$$worm /user:deptpc4\user1
net use %client5% Pa$$worm /user:deptpc5\user1
net use %client6% Pa$$worm /user:deptpc6\user1
net use %client7% Pa$$worm /user:deptpc7\user1
net use %client8% Pa$$worm /user:deptpc8\user1
net use %client9% Pa$$worm /user:deptpc9\user1
net use %client10% Pa$$worm /user:deptpc10\user1
net use %client11% Pa$$worm /user:deptpc11\user1
net use %client12% Pa$$worm /user:deptpc12\user1
copy /v/y %sandbox%\A2\*.bat %client1%\c$\dicom
copy /v/y %sandbox%\A2\*.bat %client2%\c$\dicom
copy /v/y %sandbox%\A2\*.bat %client3%\c$\dicom
copy /v/y %sandbox%\A2\*.bat %client4%\c$\dicom
copy /v/y %sandbox%\A2\*.bat %client5%\c$\dicom
copy /v/y %sandbox%\A2\*.bat %client6%\c$\dicom
copy /v/y %sandbox%\A2\*.bat %client7%\c$\dicom
copy /v/y %sandbox%\A2\*.bat %client8%\c$\dicom
copy /v/y %sandbox%\A2\*.bat %client9%\c$\dicom
copy /v/y %sandbox%\A2\*.bat %client10%\c$\dicom
copy /v/y %sandbox%\A2\*.bat %client11%\c$\dicom
copy /v/y %sandbox%\A2\*.bat %client12%\c$\dicom
net use /d %client1% /y
net use /d %client2% /y
net use /d %client3% /y
net use /d %client4% /y
net use /d %client5% /y
net use /d %client6% /y
net use /d %client7% /y
net use /d %client8% /y
net use /d %client9% /y
net use /d %client10% /y
net use /d %client11% /y
net use /d %client12% /y
exit

thanks for looking!

Docjay
  • 123
  • 3
  • 14

1 Answers1

0

Sounds like it would be a lot easier to just save the batch file on a server share then change their shortcuts to point to that. Less file copying over and over again. Then no matter what, they're always getting the latest copy you updated from the server.

BP09
  • 145
  • 1
  • 8