Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Batch file won't work

Posted on 2011-03-25
11
Medium Priority
?
597 Views
Last Modified: 2012-05-11
I created a batch file to copy and past an access database from the server to the clients computers, but it does not do the job. Can someone tell me what is wrong with my batch file. Thanks!
The batch file is as follow:

@echo off
rem This batch file installs the Membership front-end (Access .MDB file) on the user's PC.
rem It runs from the server where the front-end resides.

C:
xcopy "\\server_name\directory_from_the server\Membership.mdb" "C:\Membership\" /y /i
exit
0
Comment
Question by:SambaCor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 11

Expert Comment

by:nordtorp
ID: 35218662
try to use this instead:

C:
net use x: "\\server_name\directory_from_the server\"
xcopy "X:\Membership.mdb" "C:\Membership\" /y /i
exit

Open in new window

0
 

Author Comment

by:SambaCor
ID: 35218915
I tried your suggestion nordtorp, but that didn't do it either.
I forgut to mention that the file to be copied reside on a windows 2008 server. The client machines are running xp pro.
Thanks!
0
 
LVL 11

Expert Comment

by:sighar
ID: 35218987
An error message would certainly help us figure out what the problem is.

Do you have access to \\servername\sharename from the XPs? Can the user you logged in as access it and copy manually?

Also, I've had problems with copying databases when they're live, i.e. in use. Is that the case here?
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
LVL 11

Expert Comment

by:nordtorp
ID: 35219010
Try to turn on File and printer sharing on the server. You find it in Network and Sharing Center
0
 
LVL 22

Accepted Solution

by:
CompProbSolv earned 2000 total points
ID: 35219014
Can you try running the xcopy line at a workstation from a command prompt and report what the result (did it copy?  what messages did you receive) is here?
0
 

Author Comment

by:SambaCor
ID: 35219051
I don't get any error message.
Yes I have access to \\servername\sharename from the XPs.
Yes, I can copy the database and past it manually, no problem.
The database is not open.

I also hear of robocopy, would that be easier to use in my scenario? I have never use it before.
0
 
LVL 22

Expert Comment

by:CompProbSolv
ID: 35219088
You are saying that it runs fine if you just run the xcopy command, but not if you run the batch file, everything else being the same?

How are you running the batch file?  (on which computer, from run or cmd, or?)
0
 
LVL 11

Expert Comment

by:nordtorp
ID: 35219125
The robocopy command would be almost the same:

robocopy \\source \\destination
0
 

Author Comment

by:SambaCor
ID: 35219229
When I run xcopy from the command prompt I get the error: file not found.
But when I right click on the file and copy (from the shared drive), I am able to past it on the local machine.
I am running the batch file on the xp machine by just double clicking it. The batch file is a short cut on the desktop. But it is located on the shared folder on the server.
0
 

Author Comment

by:SambaCor
ID: 35219308
Sorry guys xcopy from command promt works fine, I didn't type it correctly.
The batch file is actually working now without the net use syntax.
I would like to give the points to CompProbSolv. And thak you to nordtorp for helping.
0
 

Author Closing Comment

by:SambaCor
ID: 35219318
It worked when I run it from the command prompt and I went from there.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question