Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Batch File Question

10 Aug 2015   #1
boweasel

Windows 7 home premium 64 bit
 
 
Batch File Question

I am incredibly ignorant about batch files, yet I'd like to create one to do weekly backups of my documents. The following .bat file more or less works, but it needs tweaking.

xcopy /e /y /c /s /i c:\users\scott\documents h:\Backup

The H: drive is a large external drive. The above file does work, but it seems to simply overwrite the folder on the H drive, and I want it to keep the weekly backups until I manually delete them. I thought the /I switch would cause it to create new versions (Backup (1), Backup (2), etc), but that seems not to work. Ideally there would be code that would append the current date to the file called Backup, but I can't seem to find any workable method for doing that.


My System SpecsSystem Spec
.
11 Aug 2015   #2
boweasel

Windows 7 home premium 64 bit
 
 

After a lot of trial and error I got the following to do pretty much what I want:
@echo off
set curr_date=%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%
mkdir G:\"%curr_date%_backup"
xcopy "%USERPROFILE%\Documents" h:\"%curr_date%_backup" /D/S/H/V/C/F/K/Y
My System SpecsSystem Spec
Reply

 Batch File Question




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
batch file question
I have a batch file to restart windows and want to do on a schedule. shutdown.exe /r /t 00 But when i try it manually or try to restart from start/restart there are programs running in the background and i have to force restart. What do i add to the batch file to stop the programs or force...
General Discussion
Task Scheduling With Batch File Question
Hi everyone, I've recently been setting up some automation via TS with great success, until now. I want it to delete daily all content, sub folders and files etc from my TV shows parent folder. I am using the following shell script (.cmd batch file) @echo off setlocal...
Performance & Maintenance
Newb, Win 7 Batch file question-KVM switching
hello Sorry if I'm posting this to the wrong place, but I'm not sure what this would be classed under. I would like to be able to change between the two computers connected to my KVM by clicking on an icon. My Belkin KVM has a remote switch that should be on my desktop, but my two cats...
General Discussion
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
General Discussion
Quick batch file question
Hi, I have just created a batch file to backup a few things on my machine, the thing is the batch file has a menu in it and i was wondering if i was to set the batch file to run under task scheduler say once a week is there a way i can get it to excute through the menu of the batch file? if not...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 21:02.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App