| 1. |
Solve : flash drive backup batch file? |
|
Answer» I think this would be the right place for this. I think this would be the right place for this. You should use xcopy, which is designed for this task. Xcopy I:\*.* "C:\Documents and Settings\Desktop\blah\bla_bla\youGetThePoint\flash backup" /E /Y Many thanks. I'd never heard of the xcopy command (too much work with older computers, I guess) ,so I looked up the SWITCHES and syntax, played around with them, and now it's working quite nicely. However, log.bat isn't executing when called upon. Even when I changed the command to "call log.bat" since they are in the same directory. It works just fine when run by itself, so I must have messed up the call command syntax or something. I doubt this'll help with the problem SOLVING any, but the contents of log.bat have been changed for the better. log.bat echo @prompt set date=$d$_set time=$t$h$h$h > {a}.bat %comspec% /e:2048 /c {a}.bat > {b}.bat for %%v in ({b}.bat del) do call %%v {?}.bat echo %date% %time% >> bacuplog.txtThat batch file looks scarily complex. What is it meant to do? What's in the batch file that calls it?I didn't write log.bat, I copied it off of the batch file help page and changed the name of the text file at the end. Its purpose is to write to a text file (bacuplog.txt) the time and date at which I last ran the file. I came across it when I was trying to solve my earlier problem and thought, "Hmm, that might be a neat feature..."The problem I'm having is when, in backup.bat, I write "call log.bat" it doesn't call log.bat. Perhaps if I threw the text in at the end, instead of having it call on the file, it might work. I'll edit this post or make a new ONE (depending on if you beat me to the post) to tell you if that works, but I'd still like to know how I messed up a command with a 4-letter keyword. OK, this may take a little longer than I thought. Since the call command line is at the end of the batch file, I have to wait for the copy function to finish. I've got a PLETHORA of files on my flash drive, a binary smorgasbord. Weird... I executed backup.bat from the command prompt without making any changes from before, and the call command worked. Alright, now I really feel like an idiot. It works just fine. Thanks again for your time, your help, your effort, and INTRODUCING me to the xcopy command. |
|