BAT file (Script)

Groundrush

Registered User.
Local time
Today, 14:54
Joined
Apr 14, 2002
Messages
1,376
I have just moved into a new premises & have been given a new shiny box with a my own server inside for my database to live in.:)

The problem I have is that I have to map the network drive for the server on each machine that will need access to it & have been trying to modify a BAT file to copy data from the new server to the C drive of each user.

I understand the coding in the BAT file as I have tested it a number of times at home & at work but for some reason I can't get it to copy from a mapped drive.

I was wondering if anyone has any suggestions as I think it may have something to do with the server & not the code that I am using.

Here is my code

Code:
@ECHO OFF

IF EXIST C:\Simal GOTO :NEXT
MKDIR C:\Simal

:NEXT

XCOPY /S /Y "G:\Simal" "C:\Simal"

CD C:\Simal\Shortcut
SHORTCUT /F:"%USERPROFILE%\Desktop\PMU 2006-2007.lnk" /A:C /I:C:\Simal\Fixit.ico /T:C:\Simal\PMU.mde

DEL ¨%USERPROFILE%\Desktop\PMU_Update.bat¨
QUIT

The path for server is \\ldl2180\data
so when mapping the drive I did it this way
Network.jpg


I will have to manually put a copy of the database folder in each machine if this does not woprk, but I hope it's just a silly error somewhere.

thanks :)
 
Is your XCOPY syntax correct? It's a long time since I've done this, but I would have written:

XCOPY "G:\Simal\*.*" "C:\Simal" /S /Y

I then don't understand your line beginning SHORTCUT - is that a reference to a separate batch file?
 
The first thing I would do is remove the @ECHO OFF so you can see any error messages.

Like John I don't think the XCOPY syntax is right, but his isn't either!
XCOPY G:\Simal\*.* C:\Simal /S /Y
should do the trick.

I don't recognise the SHORTCUT command, so like John I wonder if this is another program?
 
Like John I don't think the XCOPY syntax is right, but his isn't either!
XCOPY G:\Simal\*.* C:\Simal /S /Y
should do the trick.

Quotes are allowed these days and are necessary to cope with spaces in filenames. Not actually needed in this example I grant you...
 
Last edited:
Quotes are allowed these days and are necessary to cope with spaces in filenames. Not actually needed in this example I grant you...

Ah, thank you. I learned my batch file commands using DOS 2.1!
 
Is your XCOPY syntax correct? It's a long time since I've done this, but I would have written:

XCOPY "G:\Simal\*.*" "C:\Simal" /S /Y

I then don't understand your line beginning SHORTCUT - is that a reference to a separate batch file?


The other bit of code uses another file which creates, modifies or queries Windows shell links (shortcuts)

Optimumx I think it's called.

It's a great way of automatically creating a shortcut link to my db after running the bat file.
 

Users who are viewing this thread

Back
Top Bottom