best way to copy file
Hi, What's the best way to have a batch file copying a file from source to destination? I want to make that as a batch file and invoke whenever I want just to have a copy of my files. Thanks...Jassim Rahma
November 13th, 2011 10:30pm

Hi, I am not very sure what do you want to achiev. Do you mean that you want to a batch file, whenever you want to copy files, you just click it and run it, then copy those files to the destination? Do you mean that you don't want to edit the batch file according to you files that you want to copy? I think this could not be achieve, copy different files need different batch file, because we should point out the files we want copy. I would also like to suggest you to look for Group Policy Preference to copy files. GPP is available for Windows 2008 and later. For script, please post thread in Windows PowerSell forum: Windows PowerShell http://social.technet.microsoft.com/Forums/en/winserverpowershell/threads Hope this helps. Best Regards, Yan LiPlease remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
November 14th, 2011 9:00am

no. what I want is simply.... I have a folder which I am changing often... I just want to copy the files to my external hard disk to have a backup. I don't want it automatic, that's why I just want a batch file on my desktop and when I double click it then it will copy that folder to my external hard disk and overwrite existing if any. Jassim Rahma
November 14th, 2011 10:19am

Hi, use Xcopy cmd for copy the file. @echo off :: variables set drive=\\share folder set backupcmd=xcopy /s /c /d /e /h /i /r /y echo ### Backing up My Documents... %backupcmd% "%USERPROFILE%\My Documents" "%drive%\My Documents" echo ### Backing up Favorites... %backupcmd% "%USERPROFILE%\Favorites" "%drive%\Favorites" echo ### Backing up email and address book (Outlook Express)... %backupcmd% "%USERPROFILE%\Application Data\Microsoft\Address Book" "%drive%\Address Book" %backupcmd% "%USERPROFILE%\Local Settings\Application Data\Identities" "%drive%\Outlook Express" echo ### Backing up email and contacts (MS Outlook)... %backupcmd% "%USERPROFILE%\Local Settings\Application Data\Microsoft\Outlook" "%drive%\Outlook" echo ### Backing up the Registry... if not exist "%drive%\Registry" mkdir "%drive%\Registry" if exist "%drive%\Registry\regbackup.reg" del "%drive%\Registry\regbackup.reg" regedit /e "%drive%\Registry\regbackup.reg" echo ### Backing up the backup... if not exist "%drive%\download" mkdir "%drive%\download" %backupcmd% "C:\download" "\\172.16.32.20\test\download " echo Backup Complete! @pause Regards, Sridharan. M
Free Windows Admin Tool Kit Click here and download it now
November 14th, 2011 11:11am

Thanks... Jassim Rahma
November 14th, 2011 11:16am

Hi Jassim, I think I know what you mean,you want to copy the files to your external hard disk in order to backup files. Here's an example(save as *.bat file): ============================= @echo off echo Copying now... xcopy "E:\changing_folder\*.*" "E:\backup" /s /e /y set /p=please press any key,if you want to exit ============================= command syntax: Xcopy "source" "destination" /s /e /y The following results shows the output form the batch file. Copying now... E:\test\a.txt 1 File(s) copied please press any key,if you want to exit I hope this batch file can solve your problem. Please feel free to ask me if you have any questions. Best Regards, Anders Wang
Free Windows Admin Tool Kit Click here and download it now
November 14th, 2011 11:34am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics