Backup .bat file?

Associate
Joined
28 Dec 2002
Posts
2,400
Location
Northern Ireland
Hi Guys i am trying to configure a bat file do do a backup of some drives and folders i have on my laptop.

At the minute i am testing this with my laptop and my main desktop. What i want to do when i get it up and running is to have a .bat file on all 5 of my client pcs backing up on my main server running 2k3 server.

I think i have typed all the information in correctly but it doesnt seem to be working?

Here is what i typed in:

xcopy /e /v /y E:\ \\stuart_desktop\Data\test\Backup\Laptop\Data_Drive
xcopy /e /v /y C:\Documents and Settings\Stuart McCollum\My Documents \\stuart_desktop\Data\test\Backup\Laptop\MyDocs
xcopy /e /v /y F:\ \\stuart_desktop\Data\test\Backup\Laptop\Media_Drive

E: and F: are whole drives that need backed up from my laptop.

When i run the file it comes up and asks me to specify a directory name or file name? No matter which one i press and then check it on my desktop machine nothing appears in the folder. there should be some file in there as i placed files on purpose so i could verify that it worked?

any ideas
 
Personally I'd use a mapped drive for each client supplied by the server instead of using UNC, giving them their own home drive (Z: in this instance).

xcopy E:\1st source file path\*.* /e /s /v /y Z:\Backup\Laptop\E-drive-data
xcopy E:\2nd source file path\*.* /e /s /v /y Z:\Backup\Laptop\E-Drive-MyDocs
xcopy F:\file path\*.* /e /s /v /y Z:\Backup\Laptop\F-drive-Media
 
^^ Is The best way to do it :)

Also You can set it to run as a system service so that the user if logged on they could not stop the process.
 
You might also want to check out a little command line program called xxcopy (it's free google for it). Basically an extended version of xcopy, I use it in BAT files to backup my laptop, the clone options are particularly useful for making sure you've got the latest copies of files.
 
BigBoy said:
^^ Is The best way to do it :)
No, as that requires an interactive logon, and that's not a good practice when scripting is concerned. Your initial script was missing a wildcard for the source files ('*'), but as it stands your script will just overwrite everything already there... wasting both time and resources.

You want to dig out a command called 'Robocopy' from the resource kit (robust copy - not who you're thinking :p). This will only copy files that need to be copied (unless you tell it not too), can be ran in a restartable mode to deal with network outages, will copy file security information, and can be ran without an interactive logon (negating any requirements that need it - like mapped drives).

Code:
robocopy source \\server\destination /DATSO
Is the syntax you want iirc.
 
Otacon said:
No, as that requires an interactive logon, and that's not a good practice when scripting is concerned. Your initial script was missing a wildcard for the source files ('*'), but as it stands your script will just overwrite everything already there... wasting both time and resources.

You want to dig out a command called 'Robocopy' from the resource kit (robust copy - not who you're thinking :p). This will only copy files that need to be copied (unless you tell it not too), can be ran in a restartable mode to deal with network outages, will copy file security information, and can be ran without an interactive logon (negating any requirements that need it - like mapped drives).

Code:
robocopy source \\server\destination /DATSO
Is the syntax you want iirc.

KiX can do all that :p
 
Aye, but it's pretty old hat dude, and a bit overkill given what Kix is capable of.

Aint been near it since I ditched our last NT4 domain (and it really was needed then. System policies and batch scripting didnt cut the mustard by a long shot).
 
Otacon said:
Aye, but it's pretty old hat dude, and a bit overkill given what Kix is capable of.

Aint been near it since I ditched our last NT4 domain (and it really was needed then. System policies and batch scripting didnt cut the mustard by a long shot).

Is it? Never knew it was that old :o We still use the script that I wrote at school to query a computer's active directory location and add the appropriate printer connections and map drives based on a user's AD location. Probably is overkill for just a COPY command, but I just find it much nicer to code :)
 
Otacon said:
Aye, but it's pretty old hat dude, and a bit overkill given what Kix is capable of.

Aint been near it since I ditched our last NT4 domain (and it really was needed then. System policies and batch scripting didnt cut the mustard by a long shot).

It may be old, but its certainly not past it, personally I prefer to use it over vbscript, just because it can do pretty much everything vbscript does and more. Also with KiXforms its great. I do write in vbscript quite often too....
 
Pixie said:
just because it can do pretty much everything vbscript does and more.
It has one thing going for it that I can see - better cross platform support. A vbscript written to work on Windows XP may not work on 2000, and definitely not NT4 (I could moan about consistency in the script host for ages.. but I wont).

The reason I left Kix behind with NT4 is that it's WMI usage is somewhat limited I find. And I rely on it quite heavily.
 
I think the original batch should work, but I see a couple errors...

xcopy /e /v /y E:\ \\stuart_desktop\Data\test\Backup\Laptop\Data_Driv e
xcopy /e /v /y C:\Documents and Settings\Stuart McCollum\My Documents \\stuart_desktop\Data\test\Backup\Laptop\MyDocs
xcopy /e /v /y F:\ \\stuart_desktop\Data\test\Backup\Laptop\Media_Dri ve

If the spaces actually exist, the source will have to be contained in quotes:

xcopy /e /v /y "C:\Documents and Settings\Stuart McCollum\My Documents" \\stuart_desktop\Data\test\Backup\Laptop\MyDocs

Also, add a >> c:\bu_results.txt after each line so you can see exactly what the batch did.
 
Back
Top Bottom