Solved I would like to automatically modify a file in a batch

March 1, 2016 at 12:41:17
Specs: Windows 7
I would like to automatically modify a file in a batch process.
I have every week a file with the same name that I want to rename each week with a name and date eg backup16112012.zip backup.zip should be called so that the file will not overwrite a week later.

I want to perform this procedure in a batch


See More: I would like to automatically modify a file in a batch

Report •

#1
March 1, 2016 at 20:08:07
Run this script and post the output.

@echo %DATE%

=====================

M2 Get custom script or take private lessons


Report •

#2
March 17, 2016 at 06:53:40
✔ Best Answer
To rename a file, use
ren "filename.file" "newName.file"

To get the date format you'd like, you would have to apply a filter the variable:

set _date=%date%
set _date=%_date:.=%

To use the formatted date value in the name, you use:

ren "myFile.zip" "backup%_date%.zip"

Don't worry if plan A fails, there are 25 more letters in the alphabet ;)


Report •
Related Solutions


Ask Question