Creating Batch File To Copy Files & And Start Access App


I need to create a batch file which first copy the MS Access files from "network location A" location to another "network location B" and the start the MS Access App from the "network location B". I was able to perform all of the above when I have the mapped network drive pointing to the "network location A" with the following code:

COPY "S:\Setup\MyDB.accde" "C:\Program Files\Utilities\MyDB.accde"
COPY "S:\Setup\UnlockMyDB.accde" "C:\Utilities\UnlockMyDB.accde"
start "" "C:\Program Files\Utilities\UnlockMyDB.accde"

So basically the above commands copy the required MS Access DB Files to C Drive and then start the application by opening the UnlockMyDB.accde file which unlocks MyDB.accde file.

Now the issue is instead of S:\ drive letter I have UNC path: \\SERVER\ACCESSDATA\FileShare
and instead of C:\ drive letter I have UNC path: \\COMP01\VOL2\HOME\USERID

now how can I change my batch file to copy the contents from path: \\SERVER\ACCESSDATA\FileShare to path: \\COMP01\VOL2\HOME\USERID and then

start the MS Access DB from path: \\COMP01\VOL2\HOME\USERID

Help and guidance will be appreciated.
Blue FinAsked:
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.

Tom CieslikIT EngineerCommented:
It should be no difference for copy command to use UNC path
If it's more than one file you need to use wildcards *.*


This will work for one user named like USERID

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
Blue FinAuthor Commented:
Ok Let me try to replace the paths with Drive letters with the UNC Path and see what happens.

Tom CieslikIT EngineerCommented:
I assume that user who is executing command has ALL rights to destination share folder
Powerful Yet Easy-to-Use Network Monitoring

Identify excessive bandwidth utilization or unexpected application traffic with SolarWinds Bandwidth Analyzer Pack.

Blue FinAuthor Commented:
The user have read, write and modify privileges on both copy from and copy to network share folders.
You're going to need to use tokens to come up with UserID.  Here's an example that I use for Citrix.

del %USERPROFILE%\DwgLog\DrawingLog.accdb
copy "\\BSCCTIMBERLINE1\Timberline Office\AccessApps\Data\CommonFE\DrawingLog.accdb" %USERPROFILE%\DwgLog
Gustav BrockCIOCommented:
You can find it all here including a script you can modify as needed:

Deploy and update a Microsoft Access application in a Citrix environment

Blue FinAuthor Commented:

Yes it is working but in a test environment. Let see if it works in the prod environment as well.

@ Pat

I'll try and test your code and post back.

Tom CieslikIT EngineerCommented:
I should assign points differently :)
Tom CieslikIT EngineerCommented:
Author said it's working, no more other questions
Since the solution you accepted will NOT work in the real world but mine does, perhaps you should select my answer.
Tom CieslikIT EngineerCommented:
Hi Said


Yes it is working but in a test environment
You do realize that the method I proposed adapts itself to use the user's id so it is generic?  It is also flexible because each user has an identical shortcut that points to the batch file on the server.  That means that if I need to change something, I can change the batch file and not have to change every user's shortcut.  The method you accepted requires you to know the userid ahead of time and create individual shortcuts for each user and if you have to change the server path, you have to change every single user's shortcut.

Which would you prefer?  Just because it is working in "test" does not mean that it will work in production in this case.
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
Microsoft Access

From novice to tech pro — start learning today.