Tech Support banner

Status
Not open for further replies.
1 - 6 of 6 Posts

·
Registered
Joined
·
18,118 Posts
Discussion Starter #1
Ok, it's been ages since I've worked in pure DOS and I need to write a batch file. I need it because I run a server from home and I like to do regular backups of my data, who wouldn't, though. Anyway, I wrote a simple batch file but I don't know if it works because it vanishes so quickly. After running it in a DOS box it told me I specified too many parameters and stopped.

What I'm trying to accomplish... Copying the root folder of my server and the mySQL databases to a backup location on a seperate HDD.

Can anyone help a forgetful techie out?
 

·
Superhuman Computer
Joined
·
1,632 Posts
ok, First point with batch files is if you ever need to see what it's doing (and keep the dos box up on screen rather than have it disappear straight away) type the command "pause" on it's own line in the batch file (without the quotes of course). This brings up the "Press any key to continue . . ." thing in the window and will pause processing the batch file until you press any key.

You can normally work out what to do with the copy command by using the built-in help - to read it at your leisure, open a command prompt and type:
Code:
xcopy/?>C:\xcopy.txt
Now, open the file xcopy.txt (which should be sitting in the root of your C drive) and you can see what the valid switches are.

If you're still getting problems, can you paste the contents of your batch file here so I can see what you've put in there? I might be able to guide you better knowing the layout of your drives, directories, etc.
 

·
Registered
Joined
·
18,118 Posts
Discussion Starter #3
Code:
xcopy c:\inetpub\wwwroot E:\Erich's Backup Folder /y

xcopy C:\Program Files\EasyPHP1-8\mysql\data E:\Erich's Backup Folder /y
 

·
Superhuman Computer
Joined
·
1,632 Posts
hmm... try using quotes around the directory with spaces in it, so it would become:

Code:
xcopy c:\inetpub\wwwroot "E:\Erich's Backup Folder" /y

xcopy "C:\Program Files\EasyPHP1-8\mysql\data" "E:\Erich's Backup Folder" /y
From you saying it responded "Too many switches" it's likely looking to copy the contents to "E:\Erich's", using the switches "Backup", "Folder" and "/y"
 

·
Registered
Joined
·
4,890 Posts
Generally, with xcopy I use /s/e/c/f/y

/subfolders
/even if empty
/continue if there are errors
/display full source and destination info
/answer yes to prompts to overwrite

Also you may want to add > "E:\Erich's Backup Folder\backup.txt" to the end, so you have a full record and can check if there were skipped files.

So, your full command would be:

xcopy c:\inetpub\wwwroot "E:\Erich's Backup Folder" /s/e/c/f/y > "E:\Erich's Backup Folder\backup.txt"
 
1 - 6 of 6 Posts
Status
Not open for further replies.
Top