Friday, July 31, 2009

Help creating batch files?

I have tried to create a batch file that will copy my docs to an external hard drive and it doesn't work. Here is what I have.





@echo off


xcopy C:\Documents and Settings\Jay\My Documents E:\My DOcs Backup





I also tried to create a batch so I can delete my cookies and temp files, but that doesn't work either.





del C:\Documents and Settings\Jay\Local Settings\Temp\*.*


del C:\Documents and Settings\Jay\Local Settings\Temporary Internet Files\*.*


del C:\Documents and Settings\Jay\Cookies\*.*





I have looked on numerous websites to see if I had the correct syntax and everything looks good, maybe I missed something. The only thing that happens is when I double click on the .bat icon it just flashs once and nothing happens





Please help

Help creating batch files?
The "problem" here is your path has spaces in them, which means you need to put them "in quotes", like





xcopy "c:\documents and settings\Jay\My Documents" "e:\My docs backup"





DOS commands don't like spaces... they thought it's separate commands, unless you put them in quotes.
Reply:your copy statement is wrong it needs to be like so





xcopy C:\Documents and Settings\Jay\My Documents\* E:\My DOcs Backup /s /i





the s coppies all sub folders and the i defines the destination as a folder











(is My DOcs Backup spelt right also as you may want to check correct spellings of folder)


No comments:

Post a Comment