Batch file creation to copy files across network.

I created a simple 4 line batch file to copy 4 files from a file server to a location on the C: drive of each user in my network. I placed the batch file into the profile tab of each users properties window within ADUC.

The batch file is running properly at startup however only one of the 4 files is copied when it is run. The rest of the copy commands receive a Access Denied message. I checked the permissions of the folder where I am pulling the 4 files and everyone is set to read access so they should be able to access this folder.

If I attempt to run the batch file manually while the user is logged in under their account it only copies one file, however if I log in as myself with domain admin priveledge all 4 files copy. Attached is the code I am using in the batch. Please note, pause command was added simply for troubleshooting purposes. I understand that this may not be the best way to migrate files to multiple users, however it was the only way I knew of. If there is another way (through a group policy or whatnot) to do this, I am open to suggestions. Any help would be appreciated. Thank you.
copy "\\stmedstore\store\user\information technology\it\ics icons\prod\" "C:\WorkQ91c\Prod" /y
copy "\\stmedstore\store\user\information technology\it\ics icons\train\" "C:\WorkQ91c\train" /y
copy "\\stmedstore\store\user\information technology\it\ics icons\newtest\" "C:\WorkQ91c\newtest" /y
copy "\\stmedstore\store\user\information technology\it\ics icons\oldtest\" "C:\WorkQ91c\oldtest" /y

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I have run into similar problems where the second directory accessed is denied, but the first is allowed.

Things to try --

1.  before each copy command, CD to the directory on the server -- i.e. DOS batch CD command
2.  Try running each command as a separate batch file.  You will have a single master file, update.bat

@echo off
run copyfile1.bat
run copyfile2.bat
run copyfile3.bat
run copyfile4.bat
@echo on

Then each copyfile1-4.bat is each one of your 4 command lines above.

Try that, see what happens.
Steve KnightIT ConsultancyCommented:
If the user does have read to all those files (got to START | run and type \\stmedstore\store\user\information technology\it\ics icons\ as the user.  Can you go into the directories and copy the file locally?  

I imagine the user doesn't have write rights to C:\WorkQ91c\oldtest etc?

Try changing the destination to %temp% and see if that works, that would prove the copy works as the user from the source and that it is destination permissions


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
adw123Author Commented:
Steve, The local rights on the C:\WorkQ91c\ folders seem to be the problem. Many users do have access to this folder, although many do not it seems. When I changed the destination to %temp% as you suggested it worked on all 5 of the users that I attempted it on. Of those 5, none of them had been able to run the previous batch. Is there an easy to change the local permissions for this folder globally throughout my domain, so that when the users run this batch, the files work properly?
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Steve KnightIT ConsultancyCommented:
You can set permissions using a group policy or you could run a script across all your PC's.  I think this explains it quite well, have a look and come back with any issues, sorry but haven't got time right now to write out an explanation myself:

adw123Author Commented:
No problem, will look at this now. Thanks for your help.
adw123Author Commented:
This worked for me. Thanks.
Steve KnightIT ConsultancyCommented:
Great, glad it helped.. Steve
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows XP

From novice to tech pro — start learning today.